aboutsummaryrefslogtreecommitdiffstats
path: root/textproc/lowdown
stat options
Period:
Authors:

Commits per author per week (path 'textproc/lowdown')

AuthorW36 2024W37 2024W38 2024W39 2024Total
Total00000
' style='width: 0.3%;'/> -rw-r--r--NEWS0
-rw-r--r--README121
-rw-r--r--TODO17
-rw-r--r--acconfig.h6
-rwxr-xr-xautogen.sh19
-rw-r--r--configure.in171
-rw-r--r--data/.cvsignore5
-rw-r--r--data/GNOME_Epiphany_Automation.server.in20
-rw-r--r--data/GNOME_Epiphany_NautilusView.server.in30
-rw-r--r--data/Makefile.am29
-rw-r--r--data/art/.cvsignore2
-rw-r--r--data/art/Makefile.am7
-rw-r--r--data/art/epiphany-secure.pngbin0 -> 332 bytes-rw-r--r--data/art/epiphany-unsecure.pngbin0 -> 332 bytes-rw-r--r--data/epiphany.schemas.in627
-rw-r--r--data/glade/.cvsignore3
-rw-r--r--data/glade/Makefile.am10
-rw-r--r--data/glade/epiphany.glade1582
-rw-r--r--data/glade/prefs-dialog.glade3083
-rw-r--r--data/glade/print.glade1573
-rw-r--r--data/glade/prompts.glade722
-rw-r--r--data/glade/toolbar-editor.glade418
-rw-r--r--data/start_here.html23
-rw-r--r--data/ui/.cvsignore4
-rw-r--r--data/ui/Makefile.am11
-rw-r--r--data/ui/epiphany-ui.xml.in454
-rw-r--r--data/ui/nautilus-epiphany-view.xml.in130
-rw-r--r--embed/.cvsignore6
-rw-r--r--embed/Makefile.am57
-rw-r--r--embed/downloader-view.c1100
-rw-r--r--embed/downloader-view.h100
-rw-r--r--embed/ephy-embed-dialog.c194
-rw-r--r--embed/ephy-embed-dialog.h69
-rw-r--r--embed/ephy-embed-event.c179
-rw-r--r--embed/ephy-embed-event.h100
-rw-r--r--embed/ephy-embed-favicon.c252
-rw-r--r--embed/ephy-embed-favicon.h63
-rw-r--r--embed/ephy-embed-persist.c491
-rw-r--r--embed/ephy-embed-persist.h129
-rw-r--r--embed/ephy-embed-popup-bw.c187
-rw-r--r--embed/ephy-embed-popup-bw.h58
-rw-r--r--embed/ephy-embed-popup-control.c188
-rw-r--r--embed/ephy-embed-popup-control.h61
-rw-r--r--embed/ephy-embed-popup.c623
-rw-r--r--embed/ephy-embed-popup.h73
-rw-r--r--embed/ephy-embed-prefs.h46
-rw-r--r--embed/ephy-embed-shell.c507
-rw-r--r--embed/ephy-embed-shell.h307
-rw-r--r--embed/ephy-embed-types.h47
-rw-r--r--embed/ephy-embed-utils.c321
-rw-r--r--embed/ephy-embed-utils.h50
-rw-r--r--embed/ephy-embed.c608
-rw-r--r--embed/ephy-embed.h443
-rw-r--r--embed/ephy-favicon-cache.c367
-rw-r--r--embed/ephy-favicon-cache.h68
-rw-r--r--embed/ephy-favicon.c280
-rw-r--r--embed/ephy-favicon.h64
-rw-r--r--embed/ephy-history.c644
-rw-r--r--embed/ephy-history.h92
-rwxr-xr-xembed/find-dialog.c431
-rw-r--r--embed/find-dialog.h74
-rw-r--r--embed/mozilla/.cvsignore6
-rw-r--r--embed/mozilla/BaseProtocolContentHandler.cpp104
-rw-r--r--embed/mozilla/BaseProtocolContentHandler.h43
-rw-r--r--embed/mozilla/BaseProtocolHandler.cpp106
-rw-r--r--embed/mozilla/BaseProtocolHandler.h39
-rw-r--r--embed/mozilla/ContentHandler.cpp671
-rw-r--r--embed/mozilla/ContentHandler.h102
-rw-r--r--embed/mozilla/EphyEventListener.cpp114
-rw-r--r--embed/mozilla/EphyEventListener.h46
-rw-r--r--embed/mozilla/EphyWrapper.cpp1384
-rw-r--r--embed/mozilla/EphyWrapper.h147
-rw-r--r--embed/mozilla/EventContext.cpp669
-rw-r--r--embed/mozilla/EventContext.h65
-rw-r--r--embed/mozilla/ExternalProtocolService.cpp176
-rw-r--r--embed/mozilla/ExternalProtocolService.h50
-rw-r--r--embed/mozilla/FilePicker.cpp505
-rw-r--r--embed/mozilla/FilePicker.h94
-rw-r--r--embed/mozilla/FtpProtocolHandler.cpp58
-rw-r--r--embed/mozilla/FtpProtocolHandler.h52
-rw-r--r--embed/mozilla/GlobalHistory.cpp169
-rw-r--r--embed/mozilla/GlobalHistory.h31
-rw-r--r--embed/mozilla/IRCProtocolHandler.cpp58
-rw-r--r--embed/mozilla/IRCProtocolHandler.h43
-rw-r--r--embed/mozilla/MailtoProtocolHandler.cpp64
-rw-r--r--embed/mozilla/MailtoProtocolHandler.h43
-rw-r--r--embed/mozilla/Makefile.am108
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp226
-rw-r--r--embed/mozilla/MozRegisterComponents.h33
-rw-r--r--embed/mozilla/MozillaPrivate.cpp105
-rw-r--r--embed/mozilla/MozillaPrivate.h9
-rw-r--r--embed/mozilla/PrintProgressListener.cpp116
-rw-r--r--embed/mozilla/PrintProgressListener.h38
-rw-r--r--embed/mozilla/PrintingPromptService.cpp129
-rw-r--r--embed/mozilla/PrintingPromptService.h38
-rw-r--r--embed/mozilla/ProgressListener.cpp718
-rw-r--r--embed/mozilla/ProgressListener.h139
-rw-r--r--embed/mozilla/PromptService.cpp769
-rw-r--r--embed/mozilla/PromptService.h39
-rw-r--r--embed/mozilla/StartHereProtocolHandler.cpp162
-rw-r--r--embed/mozilla/StartHereProtocolHandler.h38
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp244
-rw-r--r--embed/mozilla/mozilla-embed-persist.h56
-rw-r--r--embed/mozilla/mozilla-embed-shell.cpp1106
-rw-r--r--embed/mozilla/mozilla-embed-shell.h55
-rw-r--r--embed/mozilla/mozilla-embed.cpp1585
-rw-r--r--embed/mozilla/mozilla-embed.h61
-rw-r--r--embed/mozilla/mozilla-i18n.c162
-rw-r--r--embed/mozilla/mozilla-i18n.h60
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp710
-rw-r--r--embed/mozilla/mozilla-notifiers.h30
-rw-r--r--embed/mozilla/mozilla-prefs.cpp185
-rw-r--r--embed/mozilla/mozilla-prefs.h44
-rw-r--r--embed/mozilla/nsUnicharUtils.cpp344
-rw-r--r--embed/mozilla/nsUnicharUtils.h96
-rwxr-xr-xembed/print-dialog.c402
-rw-r--r--embed/print-dialog.h73
-rw-r--r--idl/EphyAutomation.idl27
-rw-r--r--lib/.cvsignore6
-rw-r--r--lib/Makefile.am73
-rw-r--r--lib/eel-gconf-extensions.c556
-rw-r--r--lib/eel-gconf-extensions.h87
-rw-r--r--lib/ephy-autocompletion-source.c85
-rw-r--r--lib/ephy-autocompletion-source.h80
-rw-r--r--lib/ephy-autocompletion.c664
-rw-r--r--lib/ephy-autocompletion.h107
-rw-r--r--lib/ephy-bonobo-extensions.c679
-rw-r--r--lib/ephy-bonobo-extensions.h121
-rw-r--r--lib/ephy-dialog.c943
-rw-r--r--lib/ephy-dialog.h119
-rw-r--r--lib/ephy-dnd.c109
-rw-r--r--lib/ephy-dnd.h67
-rw-r--r--lib/ephy-file-helpers.c326
-rw-r--r--lib/ephy-file-helpers.h48
-rw-r--r--lib/ephy-filesystem-autocompletion.c343
-rw-r--r--lib/ephy-filesystem-autocompletion.h70
-rw-r--r--lib/ephy-glade.c134
-rw-r--r--lib/ephy-glade.h41
-rw-r--r--lib/ephy-gobject-misc.h77
-rw-r--r--lib/ephy-gui.c352
-rw-r--r--lib/ephy-gui.h79
-rw-r--r--lib/ephy-marshal.list16
-rw-r--r--lib/ephy-node-filter.c461
-rw-r--r--lib/ephy-node-filter.h102
-rw-r--r--lib/ephy-node.c1439
-rw-r--r--lib/ephy-node.h144
-rw-r--r--lib/ephy-prefs-utils.c285
-rw-r--r--lib/ephy-prefs-utils.h61
-rw-r--r--lib/ephy-prefs.h58
-rw-r--r--lib/ephy-state.c157
-rw-r--r--lib/ephy-state.h44
-rw-r--r--lib/ephy-stock-icons.c62
-rw-r--r--lib/ephy-stock-icons.h33
-rw-r--r--lib/ephy-string.c446
-rw-r--r--lib/ephy-string.h63
-rw-r--r--lib/ephy-thread-helpers.c35
-rw-r--r--lib/ephy-thread-helpers.h34
-rw-r--r--lib/ephy-types.h35
-rw-r--r--lib/toolbar/.cvsignore6
-rw-r--r--lib/toolbar/Makefile.am41
-rw-r--r--lib/toolbar/ephy-tbi-favicon.c188
-rw-r--r--lib/toolbar/ephy-tbi-favicon.h66
-rw-r--r--lib/toolbar/ephy-tbi-location.c205
-rw-r--r--lib/toolbar/ephy-tbi-location.h66
-rw-r--r--lib/toolbar/ephy-tbi-navigation-history.c342
-rw-r--r--lib/toolbar/ephy-tbi-navigation-history.h81
-rw-r--r--lib/toolbar/ephy-tbi-separator.c179
-rw-r--r--lib/toolbar/ephy-tbi-separator.h68
-rw-r--r--lib/toolbar/ephy-tbi-spinner.c188
-rw-r--r--lib/toolbar/ephy-tbi-spinner.h66
-rw-r--r--lib/toolbar/ephy-tbi-std-toolitem.c467
-rw-r--r--lib/toolbar/ephy-tbi-std-toolitem.h86
-rw-r--r--lib/toolbar/ephy-tbi-zoom.c304
-rw-r--r--lib/toolbar/ephy-tbi-zoom.h66
-rw-r--r--lib/toolbar/ephy-toolbar-bonobo-view.c193
-rw-r--r--lib/toolbar/ephy-toolbar-bonobo-view.h75
-rw-r--r--lib/toolbar/ephy-toolbar-editor.c634
-rw-r--r--lib/toolbar/ephy-toolbar-editor.h80
-rw-r--r--lib/toolbar/ephy-toolbar-item-factory.c158
-rw-r--r--lib/toolbar/ephy-toolbar-item-factory.h31
-rw-r--r--lib/toolbar/ephy-toolbar-item.c142
-rw-r--r--lib/toolbar/ephy-toolbar-item.h91
-rw-r--r--lib/toolbar/ephy-toolbar-tree-model.c784
-rw-r--r--lib/toolbar/ephy-toolbar-tree-model.h74
-rw-r--r--lib/toolbar/ephy-toolbar.c420
-rw-r--r--lib/toolbar/ephy-toolbar.h80
-rw-r--r--lib/widgets/.cvsignore6
-rw-r--r--lib/widgets/Makefile.am30
-rw-r--r--lib/widgets/eggtreemodelfilter.c2560
-rw-r--r--lib/widgets/eggtreemodelfilter.h123
-rw-r--r--lib/widgets/eggtreemultidnd.c415
-rw-r--r--lib/widgets/eggtreemultidnd.h78
-rw-r--r--lib/widgets/ephy-autocompletion-window.c854
-rw-r--r--lib/widgets/ephy-autocompletion-window.h87
-rw-r--r--lib/widgets/ephy-ellipsizing-label.c774
-rw-r--r--lib/widgets/ephy-ellipsizing-label.h71
-rw-r--r--lib/widgets/ephy-location-entry.c700
-rw-r--r--lib/widgets/ephy-location-entry.h74
-rw-r--r--lib/widgets/ephy-notebook.c843
-rw-r--r--lib/widgets/ephy-notebook.h99
-rw-r--r--lib/widgets/ephy-spinner.c897
-rw-r--r--lib/widgets/ephy-spinner.h78
-rw-r--r--lib/widgets/ephy-tree-model-sort.c240
-rw-r--r--lib/widgets/ephy-tree-model-sort.h59
-rw-r--r--po/.cvsignore6
-rw-r--r--po/ChangeLog0
-rw-r--r--po/POTFILES.in45
-rw-r--r--src/.cvsignore6
-rw-r--r--src/Makefile.am101
-rwxr-xr-xsrc/appearance-prefs.c458
-rw-r--r--src/appearance-prefs.h58
-rw-r--r--src/bookmarks/.cvsignore6
-rw-r--r--src/bookmarks/Makefile.am31
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c534
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.h59
-rw-r--r--src/bookmarks/ephy-bookmarks.c988
-rw-r--r--src/bookmarks/ephy-bookmarks.h108
-rw-r--r--src/bookmarks/ephy-keywords-entry.c286
-rw-r--r--src/bookmarks/ephy-keywords-entry.h68
-rw-r--r--src/bookmarks/ephy-new-bookmark.c340
-rw-r--r--src/bookmarks/ephy-new-bookmark.h65
-rw-r--r--src/bookmarks/ephy-node-view.c531
-rw-r--r--src/bookmarks/ephy-node-view.h82
-rw-r--r--src/bookmarks/ephy-tree-model-node.c702
-rw-r--r--src/bookmarks/ephy-tree-model-node.h81
-rw-r--r--src/ephy-automation.c217
-rw-r--r--src/ephy-automation.h52
-rw-r--r--src/ephy-favorites-menu.c275
-rw-r--r--src/ephy-favorites-menu.h66
-rw-r--r--src/ephy-history-model.c838
-rw-r--r--src/ephy-history-model.h84
-rw-r--r--src/ephy-main.c340
-rw-r--r--src/ephy-nautilus-view.c954
-rw-r--r--src/ephy-nautilus-view.h84
-rw-r--r--src/ephy-shell.c525
-rw-r--r--src/ephy-shell.h101
-rw-r--r--src/ephy-tab.c945
-rw-r--r--src/ephy-tab.h105
-rw-r--r--src/ephy-window.c1428
-rw-r--r--src/ephy-window.h140
-rwxr-xr-xsrc/general-prefs.c484
-rw-r--r--src/general-prefs.h58
-rwxr-xr-xsrc/history-dialog.c478
-rw-r--r--src/history-dialog.h63
-rw-r--r--src/language-editor.c388
-rw-r--r--src/language-editor.h67
-rwxr-xr-xsrc/pdm-dialog.c669
-rw-r--r--src/pdm-dialog.h56
-rw-r--r--src/popup-commands.c222
-rw-r--r--src/popup-commands.h58
-rwxr-xr-xsrc/ppview-toolbar.c388
-rw-r--r--src/ppview-toolbar.h63
-rw-r--r--src/prefs-dialog.c335
-rw-r--r--src/prefs-dialog.h63
-rw-r--r--src/session.c690
-rw-r--r--src/session.h84
-rwxr-xr-xsrc/statusbar.c321
-rw-r--r--src/statusbar.h70
-rwxr-xr-xsrc/toolbar.c982
-rw-r--r--src/toolbar.h88
-rwxr-xr-xsrc/ui-prefs.c232
-rw-r--r--src/ui-prefs.h58
-rw-r--r--src/window-commands.c917
-rw-r--r--src/window-commands.h196
271 files changed, 71076 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 000000000..98c606041
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,14 @@
+*.gz
+stamp-h
+stamp-h.in
+stamp-h1
+.*.swp
+libtool
+ltmain.sh
+intltool*
+configure
+config.*
+aclocal.m4
+Makefile
+Makefile.in
+*.cache
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/AUTHORS
diff --git a/COPYING b/COPYING
new file mode 100644
index 000000000..d60c31a97
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 000000000..971d6188a
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,875 @@
+2002-12-30 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/ephy-favicon-cache.c: (ephy_favicon_cache_dest),
+ (ephy_favicon_cache_insert_from_url),
+ (favicon_download_completed_cb):
+ * lib/ephy-dnd.c: (ephy_dnd_enable_model_drag_source):
+ * lib/ephy-dnd.h:
+ * lib/widgets/eggtreemultidnd.c:
+ (egg_tree_multi_drag_source_drag_data_get),
+ (egg_tree_multi_drag_drag_data_get):
+ * lib/widgets/eggtreemultidnd.h:
+ * lib/widgets/ephy-tree-model-sort.c:
+ (ephy_tree_model_sort_multi_drag_data_delete),
+ (each_url_get_data_binder),
+ (ephy_tree_model_sort_multi_drag_data_get):
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-node-view.c:
+ (ephy_node_view_enable_drag_source):
+ * src/bookmarks/ephy-node-view.h:
+ * src/history-dialog.c: (history_dialog_setup_view):
+
+ Use ephy-dnd for tree model too.
+ Fix favicons.
+
+2002-12-30 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/epiphany.schemas.in:
+ * lib/widgets/eggtreemodelfilter.c:
+ (egg_tree_model_filter_build_level):
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_get_dimensions),
+ (ephy_autocompletion_window_show), (hack_tree_view_move_selection),
+ (ephy_autocompletion_window_key_press_hack),
+ (ephy_autocompletion_window_key_press_cb),
+ (ephy_autocompletion_window_hide):
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_clean_empty_keywords), (bookmarks_removed_cb):
+ * src/bookmarks/ephy-new-bookmark.c: (build_editing_table),
+ (ephy_new_bookmark_construct):
+ * src/bookmarks/ephy-node-view.c: (ephy_node_view_finalize):
+ * src/history-dialog.c: (history_dialog_finalize):
+
+ Fix some bookmarks crashes.
+ Cycle between the two views in autocompletion when
+ moving with keys.
+
+2002-12-29 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * TODO:
+ * lib/ephy-dnd.h:
+ * lib/ephy-marshal.c: (ephy_marshal_VOID__POINTER_POINTER):
+ * lib/ephy-marshal.h:
+ * lib/ephy-marshal.list:
+ * lib/widgets/Makefile.am:
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_new):
+ * src/bookmarks/ephy-node-view.c:
+ (ephy_node_view_row_activated_cb), (node_from_sort_iter_cb),
+ (ephy_node_view_construct), (ephy_node_view_add_column),
+ (get_selection), (ephy_node_view_select_node),
+ (ephy_node_view_enable_drag_source):
+ * src/bookmarks/ephy-node-view.h:
+ * src/history-dialog.c: (add_column),
+ (history_view_row_activated_cb), (node_from_sort_iter_cb),
+ (history_dialog_setup_view):
+
+ Implement column sorting / drag and drop for history
+ and bookmarks.
+
+2002-12-29 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/glade/epiphany.glade:
+ * embed/ephy-history.c: (hosts_added_cb), (hosts_removed_cb),
+ (ephy_history_add_host), (ephy_history_add_page),
+ (ephy_history_set_page_title):
+ * embed/ephy-history.h:
+ * src/bookmarks/ephy-node-filter.c:
+ (ephy_node_filter_expression_evaluate):
+ * src/ephy-history-model.c: (get_one_level_path_real),
+ (get_path_real), (ephy_history_model_get_path),
+ (get_property_as_date), (ephy_history_model_get_value),
+ (ephy_history_model_update_node), (root_child_removed_cb),
+ (root_child_added_cb):
+ * src/history-dialog.c: (history_view_row_activated_cb),
+ (history_dialog_setup_view), (get_date_filter),
+ (history_dialog_setup_filter), (history_dialog_init),
+ (history_dialog_new_with_parent):
+
+ Reimplement filtering, fix a few bugs. Please remove
+ ephy-history.xml again, should be the last time, sorry.
+
+2002-12-28 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/ephy-history.c: (ephy_history_add_page):
+ * src/ephy-history-model.c: (get_one_level_path_real),
+ (get_path_real), (ephy_history_model_get_path),
+ (ephy_history_model_update_node), (root_child_removed_cb),
+ (root_child_added_cb):
+
+ Update the model correctly when the history changes.
+
+2002-12-28 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/ephy-history.c: (ephy_history_add_host):
+
+ Fix memory corruption. The history now should work
+ better but please kill ephy-history.xml or you could
+ get crashes.
+
+2002-12-28 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/ephy-history.c: (ephy_history_init),
+ (ephy_history_add_page), (ephy_history_clear),
+ (ephy_history_get_hosts), (ephy_history_get_pages):
+ * embed/ephy-history.h:
+ * src/Makefile.am:
+ * src/ephy-history-model.c: (ephy_history_model_get_type),
+ (ephy_history_model_class_init), (ephy_history_model_init),
+ (ephy_history_model_finalize), (filter_changed_cb),
+ (ephy_history_model_set_property),
+ (ephy_history_model_get_property), (ephy_history_model_new),
+ (ephy_history_model_tree_model_init),
+ (ephy_history_model_get_flags), (ephy_history_model_get_n_columns),
+ (ephy_history_model_get_column_type),
+ (ephy_history_model_get_iter), (ensure_iter), (get_parent_node),
+ (get_path_real), (ephy_history_model_get_path),
+ (ephy_history_model_get_host_value),
+ (ephy_history_model_get_value), (ephy_history_model_iter_next),
+ (ephy_history_model_iter_children),
+ (ephy_history_model_iter_has_child),
+ (ephy_history_model_iter_n_children),
+ (ephy_history_model_iter_nth_child),
+ (ephy_history_model_iter_parent),
+ (ephy_history_model_node_from_iter),
+ (ephy_history_model_iter_from_node),
+ (ephy_history_model_update_node), (root_child_removed_cb),
+ (root_child_added_cb), (root_child_changed_cb),
+ (ephy_history_model_column_get_type):
+ * src/ephy-history-model.h:
+ * src/history-dialog.c: (add_column), (history_dialog_setup_view),
+ (history_dialog_init):
+
+ Implement an history model and use it.
+
+2002-12-27 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/Makefile.am:
+ * embed/Makefile.am:
+ * embed/ephy-embed-favicon.c: (location_changed_cb),
+ (ephy_embed_favicon_set_property):
+ * embed/ephy-embed-shell.c: (ephy_embed_shell_init),
+ (ephy_embed_shell_finalize), (ephy_embed_shell_get_favicon_cache),
+ (impl_get_global_history):
+ * embed/ephy-embed-shell.h:
+ * embed/ephy-favicon-cache.c: (ephy_favicon_cache_set_property),
+ (ephy_favicon_cache_get_property), (ephy_favicon_cache_class_init),
+ (ephy_favicon_cache_init), (ephy_favicon_cache_finalize),
+ (ephy_favicon_cache_new), (ephy_favicon_cache_lookup),
+ (ephy_favicon_cache_lookup_direct), (ephy_favicon_cache_insert),
+ (ephy_favicon_cache_dest):
+ * embed/ephy-favicon-cache.h:
+ * embed/ephy-favicon.c: (cache_changed_cb):
+ * embed/ephy-history.c: (ephy_history_get_type),
+ (ephy_history_autocompletion_source_set_basic_key),
+ (ephy_history_autocompletion_source_foreach),
+ (ephy_history_emit_data_changed),
+ (ephy_history_autocompletion_source_init),
+ (ephy_history_class_init), (ephy_history_load),
+ (ephy_history_save), (hosts_added_cb), (hosts_removed_cb),
+ (pages_added_cb), (pages_removed_cb), (ephy_history_init),
+ (ephy_history_finalize), (ephy_history_new),
+ (ephy_history_add_host), (ephy_history_visited),
+ (ephy_history_get_page_visits), (ephy_history_add_page),
+ (ephy_history_get_page), (ephy_history_is_page_visited),
+ (ephy_history_set_page_title), (ephy_history_clear),
+ (ephy_history_get_root), (ephy_history_get_last_page):
+ * embed/ephy-history.h:
+ * embed/global-history.c:
+ * embed/global-history.h:
+ * embed/mozilla/EphyWrapper.cpp:
+ * embed/mozilla/GlobalHistory.cpp:
+ * lib/Makefile.am:
+ * lib/ephy-node.c: (ephy_node_get_type), (ephy_node_class_init),
+ (int_equal), (int_hash), (ephy_node_init), (ephy_node_finalize),
+ (remove_child), (ephy_node_dispose),
+ (ephy_node_set_object_property), (ephy_node_get_object_property),
+ (ephy_node_new), (ephy_node_get_id), (node_from_id_real),
+ (ephy_node_get_from_id), (ephy_node_ref), (ephy_node_unref),
+ (ephy_node_freeze), (ephy_node_thaw), (child_changed),
+ (real_set_property), (ephy_node_set_property),
+ (ephy_node_get_property), (ephy_node_get_property_string),
+ (ephy_node_get_property_boolean), (ephy_node_get_property_long),
+ (ephy_node_get_property_int), (ephy_node_get_property_double),
+ (ephy_node_get_property_float), (ephy_node_get_property_node),
+ (ephy_node_get_property_time), (save_parent),
+ (ephy_node_save_to_xml), (ephy_node_new_from_xml),
+ (real_add_child), (ephy_node_add_child), (real_remove_child),
+ (ephy_node_remove_child), (ephy_node_has_child),
+ (ephy_node_get_children), (ephy_node_get_n_children),
+ (ephy_node_get_nth_child), (get_child_index_real),
+ (ephy_node_get_child_index), (ephy_node_get_next_child),
+ (ephy_node_get_previous_child), (ephy_node_system_init),
+ (ephy_node_system_shutdown), (ephy_node_new_id),
+ (id_factory_set_to), (write_lock_to_read_lock),
+ (read_lock_to_write_lock), (lock_gdk), (unlock_gdk):
+ * lib/ephy-node.h:
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/ephy-bookmarks.c: (get_history_item_score),
+ (compute_lower_fav), (add_to_favorites), (history_site_visited_cb),
+ (ephy_setup_history_notifiers), (ephy_bookmarks_init),
+ (ephy_bookmarks_finalize):
+ * src/bookmarks/ephy-node.c:
+ * src/bookmarks/ephy-node.h:
+ * src/ephy-shell.c: (ephy_shell_init), (ephy_shell_finalize),
+ (build_homepage_url), (ephy_shell_get_autocompletion):
+ * src/ephy-shell.h:
+ * src/history-dialog.c: (history_dialog_setup_view),
+ (history_dialog_setup_filter), (history_dialog_init),
+ (history_dialog_set_embedded), (history_dialog_finalize),
+ (history_host_checkbutton_toggled_cb), (history_entry_changed_cb),
+ (history_time_optionmenu_changed_cb),
+ (history_clear_button_clicked_cb):
+
+ Rewrite the history using ephy node.
+ Use the history to store favicons locations.
+
+2002-12-26 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/ephy-embed-favicon.c: (net_state_cb), (favicon_cb):
+
+ fix some bugs
+
+2002-12-26 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * TODO:
+ * embed/ephy-embed-favicon.c: (net_state_cb), (favicon_cb),
+ (ephy_embed_favicon_set_property),
+ (ephy_embed_favicon_get_property), (ephy_embed_favicon_get_embed):
+ * embed/ephy-embed.c: (ephy_embed_base_init),
+ (ephy_embed_get_link_tags):
+ * embed/ephy-embed.h:
+ * embed/mozilla/EphyWrapper.cpp:
+ * embed/mozilla/EphyWrapper.h:
+ * embed/mozilla/Makefile.am:
+ * embed/mozilla/mozilla-embed.cpp:
+
+ Make favicons work :)
+
+2002-12-26 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * configure.in:
+ * embed/find-dialog.c: (find_dialog_go_next),
+ (find_dialog_go_prev):
+ * lib/ephy-autocompletion.c:
+ (ephy_autocompletion_get_matches_sorted_by_score),
+ (ephy_autocompletion_refine_matches),
+ (ephy_autocompletion_update_matches_full),
+ (ephy_autocompletion_sort_by_score):
+ * lib/ephy-autocompletion.h:
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_get_dimensions),
+ (ephy_autocompletion_window_fill_store_chunk),
+ (ephy_autocompletion_window_show):
+ * src/popup-commands.c: (popup_cmd_add_bookmark):
+
+ Fix a regression in find dialog.
+ Fix autocompletion flickering
+
+2002-12-25 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/find-dialog.c: (find_dialog_go_next),
+ (find_dialog_go_prev):
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_autocompletion_source_foreach):
+
+ Fix crash on find next.
+ Fix crash on autocompletion.
+
+2002-12-24 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (keyword_node_selected_cb), (ephy_bookmarks_editor_construct):
+
+ Regression fixed.
+
+2002-12-24 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/ephy-bookmarks-editor.c: (keywords_changed_cb),
+ (keywords_removed_cb), (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_add),
+ (ephy_bookmarks_unset_keyword), (diff_keywords),
+ (ephy_bookmarks_update_keywords):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/window-commands.c: (window_cmd_bookmarks_add_default):
+
+ Implement a small dialog asking title/keywords when adding
+ bookmarks.
+ (Regression: removing a selected keyword doesnt work
+ anymore, will fix)
+
+2002-12-24 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/glade/epiphany.glade:
+ * data/ui/epiphany-ui.xml.in:
+ * embed/mozilla/ContentHandler.cpp:
+ * embed/mozilla/FilePicker.cpp:
+ * embed/mozilla/FilePicker.h:
+ * lib/widgets/Makefile.am:
+ * lib/widgets/ephy-sidebar.c:
+ * lib/widgets/ephy-sidebar.h:
+ * src/ephy-tab.c: (ephy_tab_init), (get_host_name_from_uri):
+ * src/ephy-window.c: (update_layout_toggles), (setup_layout_menus),
+ (ephy_window_init), (save_window_chrome),
+ (translate_default_chrome), (ephy_window_set_chrome),
+ (ephy_window_update_all_controls):
+ * src/ephy-window.h:
+ * src/session.c:
+
+ Drop sidebar and useless bytes progress messages.
+
+2002-12-23 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_get_dimensions),
+ (ephy_autocompletion_window_show),
+ (ephy_autocompletion_window_hide):
+ * src/session.c: (do_session_resume), (crashed_resume_dialog),
+ (session_autoresume):
+
+ fix autocompl bugs.
+ Simpler recover dialog.
+
+2002-12-23 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_finalize_impl),
+ (ephy_autocompletion_window_init_widgets),
+ (ephy_autocompletion_window_set_autocompletion),
+ (ephy_autocompletion_window_get_dimensions),
+ (ephy_autocompletion_window_fill_store_chunk),
+ (ephy_autocompletion_window_show),
+ (ephy_autocompletion_window_event_after_cb):
+ * lib/widgets/ephy-location-entry.c: (ephy_location_ignore_prefix),
+ (ephy_location_entry_autocompletion_show_alternatives_to),
+ (ephy_location_entry_key_press_event_cb):
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_autocompletion_source_foreach):
+
+ Never show an horizontal scrollbar.
+ Put a limit to completions, ever show bookmarks / smart
+ bookmarks matches. Order bookmarks at the bottom of
+ completions.
+ Ignore common used web prefixes (like www)
+
+2002-12-22 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/ephy-autocompletion.c: (ephy_autocompletion_get_num_matches),
+ (ephy_autocompletion_get_num_action_matches),
+ (ephy_autocompletion_refine_matches),
+ (ephy_autocompletion_update_matches_full_item), (acma_destroy),
+ (acma_append):
+ * lib/ephy-autocompletion.h:
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_init),
+ (ephy_autocompletion_window_finalize_impl),
+ (ephy_autocompletion_window_selection_changed_cb),
+ (ephy_autocompletion_window_get_dimensions),
+ (ephy_autocompletion_window_show),
+ (ephy_autocompletion_window_key_press_hack),
+ (ephy_autocompletion_window_key_press_cb),
+ (ephy_autocompletion_window_event_after_cb):
+ * lib/widgets/ephy-location-entry.c: (ephy_location_entry_init),
+ (ephy_location_entry_content_is_text),
+ (ephy_location_entry_activate_cb),
+ (ephy_location_entry_autocompletion_window_url_activated_cb):
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_autocompletion_source_foreach),
+ (ephy_bookmarks_save), (ephy_bookmarks_solve_smart_url):
+ * src/ephy-shell.c: (ephy_shell_get_autocompletion):
+ * src/toolbar.c: (toolbar_location_url_activate_cb):
+
+ Complete smart bookmarks "autocompletion".
+
+2002-12-21 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/ephy-autocompletion.c: (ephy_autocompletion_refine_matches),
+ (ephy_autocompletion_update_matches),
+ (ephy_autocompletion_update_matches_full_item):
+ * lib/ephy-autocompletion.h:
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_class_init),
+ (ephy_autocompletion_window_selection_add_selected),
+ (ephy_autocompletion_window_get_dimensions),
+ (ephy_autocompletion_window_fill_store_chunk),
+ (ephy_autocompletion_window_show),
+ (ephy_autocompletion_window_key_press_hack),
+ (ephy_autocompletion_window_event_after_cb):
+ * lib/widgets/ephy-autocompletion-window.h:
+ * lib/widgets/ephy-location-entry.c:
+ (ephy_location_entry_class_init),
+ (ephy_location_entry_activate_cb),
+ (ephy_location_entry_set_autocompletion),
+ (ephy_location_entry_autocompletion_window_url_activated_cb),
+ (ephy_location_entry_list_event_after_cb):
+ * lib/widgets/ephy-location-entry.h:
+ * src/bookmarks/ephy-bookmarks.c: (options_skip_spaces),
+ (options_find_value_end), (options_find_next_option),
+ (smart_url_options_get), (get_smarturl_only),
+ (ephy_bookmarks_solve_smart_url):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/toolbar.c: (toolbar_location_url_activate_cb),
+ (toolbar_setup_location_entry):
+
+ Hide views when empty, fix sizing to deal with
+ visibility.
+ Make bookmarks open correctly.
+ Add some smart bookmarks solving code.
+
+2002-12-21 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/Makefile.am:
+ * data/epiphany.schemas.in:
+ * embed/mozilla/Makefile.am:
+ * embed/mozilla/MozRegisterComponents.cpp:
+ * embed/mozilla/StartHereProtocolHandler.cpp:
+ * embed/mozilla/StartHereProtocolHandler.h:
+ * lib/ephy-gui.c: (shift_color_component),
+ (ephy_gui_rgb_shift_color), (rgb16_to_rgb),
+ (ephy_gui_gdk_color_to_rgb), (ephy_gui_gdk_rgb_to_color):
+ * lib/ephy-gui.h:
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_init_widgets):
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_autocompletion_source_foreach):
+ * src/popup-commands.c: (popup_cmd_add_bookmark):
+
+ Use a darker color for the actions part of the
+ autocompletion window.
+ Add a (sucky) start-here: page and use it as
+ default homepage.
+
+2002-12-20 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/global-history.c: (history_add_url_to_list),
+ (global_history_get_urls_list),
+ (global_history_autocompletion_source_foreach_aux),
+ (global_history_autocompletion_source_foreach):
+ * lib/ephy-autocompletion-source.c:
+ (ephy_autocompletion_source_base_init):
+ * lib/ephy-autocompletion-source.h:
+ * lib/ephy-autocompletion.c:
+ (ephy_autocompletion_get_common_prefix),
+ (ephy_autocompletion_update_matches),
+ (ephy_autocompletion_update_matches_full_item),
+ (ephy_autocompletion_update_matches_full),
+ (ephy_autocompletion_compare_scores_and_alpha),
+ (ephy_autocompletion_sort_by_score):
+ * lib/ephy-autocompletion.h:
+ * lib/ephy-filesystem-autocompletion.c:
+ (ephy_filesystem_autocompletion_autocompletion_source_foreach):
+ * lib/widgets/ephy-autocompletion-window.c:
+ (ephy_autocompletion_window_finalize_impl),
+ (ephy_autocompletion_window_init_widgets),
+ (ephy_autocompletion_window_selection_changed_cb),
+ (ephy_autocompletion_window_selection_add_selected),
+ (ephy_autocompletion_window_get_dimensions),
+ (ephy_autocompletion_window_fill_store_chunk),
+ (ephy_autocompletion_window_show):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_get_type),
+ (ephy_bookmarks_autocompletion_source_set_basic_key),
+ (ephy_bookmarks_autocompletion_source_foreach),
+ (ephy_bookmarks_emit_data_changed),
+ (ephy_bookmarks_autocompletion_source_init),
+ (bookmarks_removed_cb), (ephy_bookmarks_init),
+ (ephy_bookmarks_add):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/ephy-shell.c: (ephy_shell_get_autocompletion):
+ * src/window-commands.c: (window_cmd_bookmarks_add_default):
+
+ Begin to implement smarter location entry. Now it looks
+ for bookmarks/keywords and show them by title.
+ Urls are showed just as urls (no more title).
+ At the bottom you can select smartbookmarks in a mozilla
+ like way (how do you add smb ? just edit xml for now ;)).
+ It's still incomplete but prolly it's not going to be all
+ the work I thought at beginning.
+
+2002-12-20 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c: (diff_keywords),
+ (update_keywords):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_find_keyword):
+ * src/bookmarks/ephy-keywords-entry.c: (try_to_expand_keyword):
+
+ Fix several keywords bugs. Should start to get usable.
+
+2002-12-19 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c: (build_editing_table):
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_clean_empty_keywords), (keywords_added_cb),
+ (keywords_removed_cb), (bookmarks_removed_cb),
+ (ephy_bookmarks_init), (ephy_bookmarks_finalize),
+ (ephy_bookmarks_find_keyword), (ephy_bookmarks_set_keyword),
+ (ephy_bookmarks_unset_keyword):
+ * src/bookmarks/ephy-keywords-entry.c:
+ (ephy_keywords_entry_class_init), (try_to_expand_keyword),
+ (entry_would_have_inserted_characters),
+ (ephy_keywords_entry_key_press), (ephy_keywords_entry_init):
+ * src/bookmarks/ephy-keywords-entry.h:
+
+ Complete autocompletion implementation.
+ Rewrite keywords removing code. Still bad bugs
+ but getting better.
+
+2002-12-16 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * configure.in:
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/ephy-bookmarks-editor.c: (update_keywords),
+ (keywords_changed_cb), (build_editing_table):
+ * src/bookmarks/ephy-bookmarks.c: (keywords_added_cb),
+ (keywords_removed_cb), (partial_match_equal),
+ (ephy_bookmarks_init), (ephy_bookmarks_finalize),
+ (ephy_bookmarks_find_keyword), (ephy_bookmarks_set_keyword),
+ (ephy_bookmarks_unset_keyword):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/bookmarks/ephy-node-view.c: (ephy_node_view_select_node):
+ * src/bookmarks/ephy-node-view.h:
+
+ Fix some keywords bugs and start working on autocompletion
+
+2002-12-15 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
+ (add_to_favorites), (history_site_visited_cb),
+ (ephy_bookmarks_finalize):
+ * src/ephy-favorites-menu.c: (ephy_favorites_menu_set_path),
+ (ephy_favorites_menu_verb_cb), (ephy_favorites_menu_rebuild),
+ (ephy_favorites_menu_update):
+ * src/ephy-window.c: (ephy_window_init):
+
+ Make favorites really work
+
+2002-12-15 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * TODO:
+ * embed/global-history.c: (global_history_get_item):
+ * embed/global-history.h:
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
+ (get_history_item_score), (compute_lower_fav),
+ (ephy_bookmarks_update_favorites), (add_to_favorites),
+ (update_favorites_menus), (history_site_visited_cb),
+ (keywords_added_cb), (keywords_removed_cb), (favorites_added_cb),
+ (favorites_removed_cb), (ephy_bookmarks_init),
+ (ephy_bookmarks_finalize), (ephy_bookmarks_get_keyword):
+
+ Complete favorites implementation, still buggy.
+
+2002-12-14 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/ui/epiphany-ui.xml.in:
+ * embed/global-history.c: (global_history_class_init),
+ (global_history_visited):
+ * embed/global-history.h:
+ * src/Makefile.am:
+ * src/bookmarks/ephy-bookmarks.c: (history_site_visited_cb),
+ (ephy_setup_history_notifiers), (bookmarks_added_cb),
+ (bookmarks_removed_cb), (ephy_bookmarks_init),
+ (ephy_bookmarks_finalize), (ephy_bookmarks_get_favorites):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/ephy-favorites-menu.c: (ephy_favorites_menu_class_init),
+ (ephy_favorites_menu_init), (ephy_favorites_menu_finalize_impl),
+ (ephy_favorites_menu_set_property),
+ (ephy_favorites_menu_get_property), (ephy_favorites_menu_new),
+ (ephy_favorites_menu_set_path), (ephy_favorites_menu_rebuild),
+ (ephy_favorites_menu_update), (ephy_favorites_menu_verb_cb):
+ * src/ephy-favorites-menu.h:
+ * src/ephy-window.c: (ephy_window_init),
+ (update_favorites_control), (ephy_window_update_control):
+ * src/ephy-window.h:
+ * src/window-recent-history-menu.c:
+ * src/window-recent-history-menu.h: some work on favorites,
+ still not working quite well
+
+2002-12-14 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_node_selected_cb), (diff_keywords),
+ (update_keywords), (keywords_entry_changed_cb), (bookmarks_filter),
+ (keyword_node_selected_cb), (build_search_box),
+ (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
+ (ephy_bookmarks_init), (ephy_bookmarks_set_keyword):
+ * src/bookmarks/ephy-node-view.c: (ephy_node_view_set_browse_mode):
+ * src/bookmarks/ephy-node-view.h: complete keyword implementation,
+ still buggy
+
+2002-12-14 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_finalize), (update_keywords),
+ (keywords_entry_changed_cb), (search_entry_changed_cb),
+ (build_search_box), (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
+ (ephy_bookmarks_init), (ephy_bookmarks_finalize),
+ (ephy_bookmarks_add_keyword), (ephy_bookmarks_get_keyword),
+ (ephy_bookmarks_set_keyword), (ephy_bookmarks_get_keywords):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/bookmarks/ephy-tree-model-node.c:
+ (ephy_tree_model_node_get_column_type),
+ (ephy_tree_model_node_get_value),
+ (ephy_tree_model_node_column_get_type):
+ * src/bookmarks/ephy-tree-model-node.h:
+ * src/ephy-window.c: some work on keywords implementation,
+ still not working
+
+2002-12-13 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/glade/epiphany.glade:
+ * data/glade/prefs-dialog.glade:
+ * data/ui/epiphany-ui.xml.in:
+ * embed/downloader-view.c: (get_selected_row),
+ (download_dialog_abort_cb):
+ * src/Makefile.am:
+ * src/ephy-tab.c: (ephy_tab_location_cb), (ephy_tab_title_cb):
+ * src/ephy-window.c: (ephy_window_init), (ephy_window_finalize),
+ (ephy_window_get_toolbar):
+ * src/ephy-window.h:
+ * src/history-dialog.c: (each_url_get_data_binder):
+ * src/language-editor.c:
+ (language_editor_remove_button_clicked_cb):
+ * src/pdm-dialog.c: (cookies_treeview_selection_changed_cb),
+ (action_treeview_selection_changed_cb),
+ (pdm_dialog_remove_button_clicked_cb), (setup_action),
+ (pdm_dialog_init),
+ (pdm_dialog_cookies_properties_button_clicked_cb):
+ * src/window-commands.c:
+ * src/window-commands.h:
+ * src/window-recent-history.c:
+ * src/window-recent-history.h: some menu rehashing, remove recent
+ history to be replaced by favourites. Fix all tree views.
+
+2002-12-12 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/find-dialog.c: (impl_show): grab focus on the entry
+
+2002-12-08 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_node_selected_cb), (update_prop_from_entry):
+
+ Fix some memory corruption.
+
+2002-12-08 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * TODO:
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_node_selected_cb), (update_prop_from_entry),
+ (title_entry_changed_cb), (keywords_entry_changed_cb),
+ (build_editing_table), (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/bookmarks/ephy-node-view.c: (ephy_node_view_class_init),
+ (ephy_node_view_selection_changed_cb), (ephy_node_view_construct):
+ * src/bookmarks/ephy-node-view.h:
+
+ Add ability to edit title and keywords (useless atm).
+
+2002-12-08 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * Makefile.am:
+ * README:
+ * configure.in:
+ * embed/mozilla/Makefile.am:
+ * lib/Makefile.am:
+ * po/.cvsignore:
+ * po/POTFILES.in:
+
+ Make it pass distcheck.
+
+ * src/ephy-tab.c: (ephy_tab_dom_mouse_down_cb):
+
+ Reintroduce page load on url pasting.
+
+2002-12-08 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_node_activated_cb),
+ (ephy_bookmarks_editor_response_cb),
+ (ephy_bookmarks_editor_construct), (ephy_bookmarks_editor_new):
+ * src/bookmarks/ephy-bookmarks-editor.h:
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
+ (ephy_bookmarks_finalize), (ephy_bookmarks_add):
+ * src/bookmarks/ephy-node-view.c:
+ (ephy_node_view_row_activated_cb), (ephy_node_view_construct),
+ (ephy_node_view_new), (ephy_node_view_init), (get_selection),
+ (ephy_node_view_get_selection), (ephy_node_view_remove):
+ * src/bookmarks/ephy-node-view.h:
+ * src/bookmarks/ephy-tree-model-node.c: (ephy_tree_model_node_new):
+ * src/ephy-shell.c: (ephy_shell_finalize):
+ * src/window-commands.c: (window_cmd_bookmarks_edit):
+
+ You can now at least add bookmarks to a list
+
+2002-12-07 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/mozilla/EphyWrapper.cpp:
+ * embed/mozilla/EphyWrapper.h: remove some unused code,
+ should build with mozilla head again
+
+2002-12-06 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_class_init),
+ (ephy_bookmarks_editor_construct), (ephy_bookmarks_editor_new),
+ (ephy_bookmarks_editor_set_property),
+ (ephy_bookmarks_editor_get_property), (ephy_bookmarks_editor_init):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_load),
+ (ephy_bookmarks_init), (ephy_bookmarks_finalize),
+ (ephy_bookmarks_add), (ephy_bookmarks_get_bookmarks):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/window-commands.c: (window_cmd_bookmarks_edit),
+ (window_cmd_bookmarks_add_default): more bookmarks work
+
+2002-12-05 Bastien Nocera <hadess@hadess.net>
+
+ * src/ephy-main.c: (ephy_main_start): get the Bonobo warning go away and Ephy to
+ just actually work
+
+2002-12-05 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/mozilla/FilePicker.cpp: actually parent the file picker
+ * src/Makefile.am:
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_class_init), (ephy_bookmarks_editor_new),
+ (ephy_bookmarks_editor_construct),
+ (ephy_bookmarks_editor_set_object_property),
+ (ephy_bookmarks_editor_get_object_property),
+ (ephy_bookmarks_editor_init):
+ * src/bookmarks/ephy-bookmarks-editor.h:
+ * src/bookmarks/ephy-node-view.c: (ephy_node_view_set_property),
+ (ephy_node_view_construct), (ephy_node_view_add_column),
+ (ephy_node_view_init):
+ * src/ephy-shell.c: (ephy_shell_init), (ephy_shell_get_bookmarks):
+ * src/ephy-shell.h:
+ * src/window-commands.c: (window_cmd_bookmarks_edit):
+ more useless bookmarks work
+
+2002-12-01 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/eggtreemodelfilter.c:
+ * src/bookmarks/eggtreemodelfilter.h:
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ * src/bookmarks/ephy-bookmarks-editor.h:
+ * src/bookmarks/ephy-node-view.c:
+ * src/bookmarks/ephy-node-view.h: more bookmarks work
+
+2002-11-30 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/ephy-embed.h:
+ * embed/find-dialog.c: (find_dialog_go_next),
+ (find_dialog_go_prev), (find_next_button_clicked_cb),
+ (find_prev_button_clicked_cb), (find_entry_activate_cb):
+ * embed/find-dialog.h:
+ * embed/mozilla/EphyWrapper.cpp:
+ * embed/mozilla/EphyWrapper.h:
+ * embed/mozilla/Makefile.am:
+ * embed/mozilla/mozilla-embed.cpp:
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/bookmarks/ephy-node-filter.c:
+ * src/bookmarks/ephy-node-filter.h:
+ * src/bookmarks/ephy-node.c: (ephy_node_class_init):
+ * src/bookmarks/ephy-tree-model-node.c:
+ * src/bookmarks/ephy-tree-model-node.h:
+ * src/window-commands.c: fix dialog/typeahead find
+ interaction. More infrastucture bookmarks work.
+
+2002-11-29 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/ephy-string.c:
+ * lib/ephy-string.h: remove no more used helper
+ * src/window-recent-history-menu.c:
+ (ephy_window_recent_history_menu_rebuild): correctly
+ encode xml strings
+
+2002-11-28 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * configure.in:
+ * lib/Makefile.am:
+ * lib/ephy-string.c: (ephy_string_store_time_in_string),
+ (ephy_string_time_to_string):
+ * lib/ephy-string.h:
+ * src/Makefile.am:
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/ephy-bookmarks.c:
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/bookmarks/ephy-node.c:
+ * src/bookmarks/ephy-node.h:
+ * src/ephy-shell.c:
+ * src/history-dialog.c: (history_dialog_update_host_item),
+ (history_dialog_update_url_item): some configure cleanups,
+ some bookmarks architecture stuff. Credits to rhythmbox
+ developers.
+
+2002-11-27 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/epiphany.schemas.in:
+ * embed/ephy-embed-event.h:
+ * embed/ephy-embed-persist.c: (ephy_embed_persist_new):
+ * embed/ephy-embed-popup.c: (setup_element_menu),
+ (setup_document_menu):
+ * embed/mozilla/Makefile.am: fix favicons, remove mozilla-config.h
+ and use the old hack. Damn we need a real fix for this.
+
+2002-11-27 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/glade/toolbar-editor.glade:
+ * lib/toolbar/ephy-toolbar-editor.c: (update_arrows_sensitivity),
+ (ephy_tb_editor_treeview_selection_changed_cb),
+ (ephy_tb_editor_setup_treeview): fix arrows sensitivity in the
+ toolbar editor
+
+2002-11-27 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * README: wrote
+ * src/ephy-shell.c: (ephy_init_services): add the monitor on the
+ right gconf dir
+ * src/history-dialog.c: fix gcon paths
+
+2002-11-27 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/art/epiphany-secure.png:
+ * data/art/epiphany-unsecure.png: resize to 18x18
+ * configure.in:
+ * embed/Makefile.am:
+ * embed/mozilla/Makefile.am:
+ * src/Makefile.am:
+ * lib/Makefile.am:
+ * lib/toolbar/Makefile.am:
+ * lib/widgets/Makefile.am: enable werror
+ * lib/ephy-file-helpers.c: missing includes
+ * lib/widgets/ephy-location-entry.c: disable completion_to by default
+ (ephy_location_entry_key_press_event_cb):
+ * src/statusbar.c: (statusbar_set_security_state): really fix it
+
+2002-11-27 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/GNOME_Epiphany_NautilusView.server.in:
+ * data/epiphany.schemas.in:
+ * data/glade/epiphany.glade:
+ * data/ui/epiphany-ui.xml.in:
+ * data/ui/nautilus-epiphany-view.xml.in:
+ * embed/global-history.c: (history_save):
+ * embed/mozilla/ContentHandler.cpp:
+ * lib/ephy-file-helpers.c: (ephy_ensure_dir_exists):
+ * lib/ephy-file-helpers.h:
+ * src/ephy-shell.c: (ephy_shell_init):
+ * src/history-dialog.c: (history_dialog_set_embedded):
+ * src/pdm-dialog.c: (pdm_dialog_init):
+ * src/session.c: (crashed_resume_dialog):
+ * src/statusbar.c: (statusbar_set_security_state):
+ Fix a few typos, get rid of mime handlers list,
+ reimplement security icon
+
+2002-11-26 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * Checked in initial codebase.
diff --git a/HACKING b/HACKING
new file mode 100644
index 000000000..430e0ff7b
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,16 @@
+In order to keep the code nice and clean we have a few requirements you'll
+need to stick to in order to get your patch accepted:
+
+- use 8-space tabs for indentation
+- curly brackets are on a new line
+- please compare with NULL or FALSE isntead of using "!"
+- callback functions have a suffix _cb
+
+ Comment blocks are written like this:
+
+/**
+ * bla_bla_cb: This is an example comment block
+ */
+
+Do NOT commit to this module without permission from me
+(marco@it.gnome.org)
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 000000000..b42a17ac4
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 000000000..068ec8e39
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,8 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = lib embed src data po
+
+EXTRA_DIST = \
+ intltool-merge.in \
+ intltool-update.in \
+ intltool-extract.in
diff --git a/NEWS b/NEWS
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 000000000..467e18dc0
--- /dev/null
+++ b/README
@@ -0,0 +1,121 @@
+Epiphany is a GNOME web browser based on the mozilla
+rendering engine.
+The name meaning:
+"An intuitive grasp of reality through
+something (as an event) usually simple and striking"
+
+MANIFESTO
+
+A web browser is more than an application, it is a way of thinking, it is
+a way of seeing the world. Epiphany's principles are simplicity and standards
+compliance.
+
+Simplicity:
+
+While Mozilla has an excellent rendering engine, its default
+XUL-based interface is considered to be overcrowded and bloated. Furthermore,
+on slower processors even trivial tasks such as pulling down a menu is less
+than responsive.
+
+Epiphany aims to utilize the simplest interface possible for a browser. Keep
+in mind that simple does not necessarily mean less powerful. We believe
+the commonly used browsers of today are too big, buggy, and bloated. Epiphany
+addresses simplicity with a small browser designed for the web -- not mail,
+newsgroups, file management, instant messenging or coffee making. The UNIX
+philosophy is to design small tools that do one thing, and do it well.
+
+Epiphany also address simplicity with modularity to make a light and powerful
+application. If something can be implemented using external applications
+or components, we use it rather than wasting resources in the web browser.
+Integration will be achived with CORBA, Bonobo, and the ever popular
+command line.
+
+Mail will be handled with your favorite e-mail application (Evolution, pine,
+mutt, balsa, pronto, whatever).
+
+Standards compliance:
+
+The introduction of non-standard features in browsers could make it difficult
+or impossible to use alternative products like Epiphany if developers embrace
+them. Alternative (standards complying) browsers could not be able to
+fully access web sites making use of these features. The success of
+non-standard features can ultimately lead to forcing one browser, on
+one platform to dominate the market.
+
+Standards compliance ensures the freedom of choice. Epiphany aims to achieve
+this.
+
+USER INTERFACE LINES
+
+- HIG compliance
+
+Epiphany is going to follow version 1.0 of the gnome
+user guidelines. Unless there are very seriuos reasons to make an
+exception not following it will be considered a bug.
+"I follow the HIG only when I like it" is not a legitimate approach.
+Any areas where we diverge from the HIG will communicated
+to the HIG team for future consideration.
+
+- Gnome integration
+
+Epiphany's main goal is to be integrated with the gnome desktop.
+We dont aim to make epiphany usable outside Gnome. If someone will like
+to use it anyway, it's just a plus. Ex: Making people happy that
+don't have control center installed is not a good reason
+to have mime configuration in epiphany itself.
+
+- Simple design
+
+Feature bloat and user interface clutter is evil :)
+
+- Preferences
+
+We will follow the new gnome policy about preferences.
+I think Havoc Pennington already explained it a lot
+better than I could ever do.
+http://www106.pair.com/rhp/free-software-ui.html
+
+- User target
+
+We target non-technical users by design.
+This happens to be 90% of the user population.
+(Technical details should not exposed in the interface)
+We target web users, we dont directly target web developers.
+A few geek-oriented feautures can be kept as
+long as they are non-obtrusive.
+
+REQUIREMENTS
+
+You will need a complete installation of Gnome 2.2 desktop.
+Mozilla API is not stable. I'll be keeping in sync epiphany cvs
+head with mozilla cvs head.
+The required mozilla version will be specified in the
+release notes.
+
+HOW TO HELP
+
+You can report new bugs on http://epiphany.mozdev.org/bugs.html.
+Feel free to send patches.
+
+About new feautures I'll just quote Metacity FAQ.
+
+Q: Will you add my feature?
+
+A: If it makes sense to turn on unconditionally,
+ or is genuinely a harmless preference that I would not
+ be embarrassed to put in a simple, uncluttered, user-friendly
+ configuration dialog.
+
+ If the only rationale for your feature is that other
+ [browsers] have it, or that you are personally used to it, or something
+ like that, then I will not be impressed. [Epiphany] is firmly in the
+ "choose good defaults" camp rather than the "offer 6 equally broken
+ ways to do it, and let the user pick one" camp.
+
+ Don't let this discourage patches and fixes - I love those. ;-)
+ Just be prepared to hear the above objections if your patch
+ adds some crack-ridden configuration option.
+
+CONTACTS
+
+Marco Pesenti Gritti <marco@it.gnome.org>
diff --git a/TODO b/TODO
new file mode 100644
index 000000000..fb0f92c9d
--- /dev/null
+++ b/TODO
@@ -0,0 +1,17 @@
+To do:
+
+- favicons doesnt work anymore
+- ephy-dnd.c we still need it ?
+- implement phoenix like popup blocking
+- urls like www.gnome.org and gnome.org should use same folder in history
+- history scoring for autocompletion
+
+Done:
+
+* simpler crash recover
+* open url on middle click
+* tree views are borked, maybe the new api doesnt return a list of rows
+* dont autocomplete on www.
+* simplify/clean autocompletion entry code
+* favicons should not be fetched on load end
+* open bookmarks, close galeon -> crash
diff --git a/acconfig.h b/acconfig.h
new file mode 100644
index 000000000..ee45fadb9
--- /dev/null
+++ b/acconfig.h
@@ -0,0 +1,6 @@
+#undef ENABLE_NLS
+#undef HAVE_CATGETS
+#undef HAVE_GETTEXT
+#undef GETTEXT_PACKAGE
+#undef HAVE_LC_MESSAGES
+#undef NAUTILUS_PREFIX
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 000000000..4eeaa4ed9
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+PKG_NAME="epiphany"
+
+(test -f $srcdir/configure.in) || {
+ echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+ echo " top-level $PKG_NAME directory"
+ exit 1
+}
+
+which gnome-autogen.sh || {
+ echo "You need to install gnome-common from the GNOME CVS"
+ exit 1
+}
+USE_GNOME2_MACROS=1 . gnome-autogen.sh
diff --git a/configure.in b/configure.in
new file mode 100644
index 000000000..34bfb362b
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,171 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(configure.in)
+AC_PREREQ(2.50)
+
+GCONF_REQUIRED=1.0.4
+GDK_PIXBUF_REQUIRED=0.13.0
+GLIB_REQUIRED=1.2.9
+LIBGLADE_REQUIRED=0.13
+GNOME_LIBS_REQUIRED=1.2.11
+GNOME_REQUIRED=1.2.8
+GNOME_VFS_REQUIRED=1.0.1
+GTK_REQUIRED=1.2.9
+LIBXML_REQUIRED=1.8.14
+OAF_REQUIRED=0.6.5
+ORBIT_REQUIRED=0.5.7
+MOZILLA_REQUIRED=1.1
+SCROLLKEEPER_REQUIRED=0.1.4
+
+AC_SUBST(SCROLLKEEPER_REQUIRED)
+AC_SUBST(GNOME_VFS_REQUIRED)
+AC_SUBST(LIBXML_REQUIRED)
+AC_SUBST(ORBIT_REQUIRED)
+AC_SUBST(LIBGLADE_REQUIRED)
+AC_SUBST(GNOME_LIBS_REQUIRED)
+AC_SUBST(MOZILLA_REQUIRED)
+
+AC_ENABLE_SHARED(yes)
+AC_ENABLE_STATIC(no)
+
+AM_INIT_AUTOMAKE(epiphany, 0.4.1)
+AM_CONFIG_HEADER(config.h)
+
+AM_PROG_LIBTOOL
+
+AC_ISC_POSIX
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_CC_STDC
+AC_HEADER_STDC
+AC_PROG_INTLTOOL
+AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+
+GNOME_COMPILE_WARNINGS(error)
+
+dnl ******************************
+dnl Nautilus View checking
+dnl ******************************
+
+build_nautilus_view=no
+AC_ARG_ENABLE(nautilus-view, [ --enable-nautilus-view (auto,yes,no)
+ Enable Nautilus View Galeon Component])
+
+AC_MSG_CHECKING(if NautilusView Galeon component is wanted)
+if test "x$enable_nautilus_view" = "x" ; then
+ enable_nautilus_view=auto
+fi
+if test "x$enable_nautilus_view" = "xauto"; then
+ temptest=`pkg-config --cflags libnautilus 2> /dev/null`
+ if test "x$temptest" = "x" ; then
+ enable_nautilus_view=no
+ else
+ enable_nautilus_view=yes
+ fi
+fi
+if test "x$enable_nautilus_view" = "xyes"; then
+ dnl AC_DEFINE(ENABLE_NAUTILUS_VIEW)
+ nautilusview_pkgs=libnautilus
+fi
+AC_MSG_RESULT($enable_nautilus_view)
+AM_CONDITIONAL(ENABLE_NAUTILUS_VIEW, test "x$enable_nautilus_view" = "xyes")
+
+dnl See if nautilus is installed in other prefix than epiphany so that we can load
+dnl nautilus throbbers even then.
+dnl Maybe FIXME: make this check not require libnautilus.pc
+dnl
+nautilus_prefix=`pkg-config --variable=prefix libnautilus 2> /dev/null`
+if test "x${nautilus_prefix}" != "x"; then
+ if test "x${prefix}" = "xNONE"; then
+ epiphany_prefix="${ac_default_prefix}"
+ else
+ epiphany_prefix="${prefix}"
+ fi
+
+ dnl We already search for nautilus throbbers in epiphany prefix, don't add the
+ dnl same directory or we'd show the throbbers twice.
+ if test "x${nautilus_prefix}" != "x${epiphany_prefix}"; then
+ AC_DEFINE_UNQUOTED(NAUTILUS_PREFIX, "${nautilus_prefix}")
+ fi
+fi
+
+PKG_CHECK_MODULES(EPIPHANY_DEPENDENCY, gtk+-2.0 libxml-2.0 libgnomeui-2.0 libglade-2.0 bonobo-activation-2.0 ORBit-2.0 libglade-2.0 gnome-vfs-2.0 gnome-vfs-module-2.0 gconf-2.0 $nautilusview_pkgs)
+AC_SUBST(EPIPHANY_DEPENDENCY_CFLAGS)
+AC_SUBST(EPIPHANY_DEPENDENCY_LIBS)
+
+ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
+AC_SUBST(ORBIT_IDL)
+
+LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
+AC_SUBST(LIBBONOBO_IDL)
+
+BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
+AC_SUBST(BONOBO_ACTIVATION_IDL)
+
+PKG_CHECK_MODULES(MOZILLA_COMPONENT, mozilla-gtkmozembed)
+dnl AC_DEFINE(ENABLE_MOZILLA_EMBED)
+AC_SUBST(MOZILLA_COMPONENT_CFLAGS)
+AC_SUBST(MOZILLA_COMPONENT_LIBS)
+
+MOZILLA_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir mozilla-gtkmozembed`"
+AC_SUBST(MOZILLA_INCLUDE_ROOT)
+
+MOZILLA_HOME="`$PKG_CONFIG --variable=libdir mozilla-gtkmozembed`"
+AC_SUBST(MOZILLA_HOME)
+
+dnl whether to build with DEBUG defined
+AC_ARG_WITH(mozilla-debug,
+ [ --with-mozilla-debug Use a debug mozilla build],
+ CXXFLAGS="-DDEBUG $CXXFLAGS",)
+
+AC_ARG_ENABLE(cpp-rtti,
+ [ --enable-cpp-rtti Enable C++ RTTI (for cvs gcc)],,
+ enable_cpp_rtti=no)
+
+if test "x$enable_cpp_rtti" = "xno"; then
+ CXXFLAGS="-fno-rtti $CXXFLAGS"
+fi
+
+dnl Specify the gconf configuration source,
+dnl default to xml::$(sysconfdir)/gconf/gconf.xml.defaults
+
+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+
+if test x"$GCONFTOOL" = xno; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+fi
+
+AM_GCONF_SOURCE_2
+
+dnl *******************************
+dnl Internationalization
+dnl *******************************
+dnl Add the languages which your application supports here.
+
+ALL_LINGUAS=""
+GETTEXT_PACKAGE=epiphany-2.0
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
+AM_GLIB_GNU_GETTEXT
+
+dnl uninstalled share dir to search data
+AC_DEFINE_UNQUOTED(SHARE_UNINSTALLED_DIR,"`pwd`/data",[path to source data dir])
+
+AC_OUTPUT([
+Makefile
+data/Makefile
+data/glade/Makefile
+data/art/Makefile
+data/ui/Makefile
+data/GNOME_Epiphany_NautilusView.server
+data/epiphany.schemas
+data/GNOME_Epiphany_Automation.server
+lib/Makefile
+lib/widgets/Makefile
+lib/toolbar/Makefile
+embed/Makefile
+embed/mozilla/Makefile
+src/Makefile
+src/bookmarks/Makefile
+po/Makefile.in
+])
diff --git a/data/.cvsignore b/data/.cvsignore
new file mode 100644
index 000000000..1f6558686
--- /dev/null
+++ b/data/.cvsignore
@@ -0,0 +1,5 @@
+GNOME_Epiphany_Automation.server
+GNOME_Epiphany_NautilusView.server
+Makefile
+Makefile.in
+epiphany.schemas
diff --git a/data/GNOME_Epiphany_Automation.server.in b/data/GNOME_Epiphany_Automation.server.in
new file mode 100644
index 000000000..05b831039
--- /dev/null
+++ b/data/GNOME_Epiphany_Automation.server.in
@@ -0,0 +1,20 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:GNOME_Epiphany_Automation_Factory" type="exe" location="epiphany">
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/ObjectFactory:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" value="Epiphany automation"/>
+ <oaf_attribute name="description" type="string" value="Epiphany automation factory"/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_Epiphany_Automation" type="factory" location="OAFIID:GNOME_Epiphany_Automation_Factory">
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ <item value="IDL:GNOME/EpiphanyAutomation:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" _value="Epiphany automation"/>
+ <oaf_attribute name="description" type="string" value="Epiphany automation"/>
+</oaf_server>
+
+</oaf_info>
diff --git a/data/GNOME_Epiphany_NautilusView.server.in b/data/GNOME_Epiphany_NautilusView.server.in
new file mode 100644
index 000000000..8af14019b
--- /dev/null
+++ b/data/GNOME_Epiphany_NautilusView.server.in
@@ -0,0 +1,30 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:GNOME_Epiphany_NautilusViewFactory" type="exe" location="epiphany --nautilus-view">
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/ObjectFactory:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" _value="Epiphany Nautilus view factory"/>
+ <oaf_attribute name="description" type="string" _value="Epiphany content view component's factory"/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_Epiphany_NautilusView" type="factory" location="OAFIID:GNOME_Epiphany_NautilusViewFactory">
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Bonobo/Unknown:1.0"/>
+ <item value="IDL:Bonobo/Control:1.0"/>
+ <item value="IDL:Nautilus/View:1.0"/>
+ </oaf_attribute>
+ <oaf_attribute name="name" type="string" _value="Epiphany Nautilus view"/>
+ <oaf_attribute name="description" type="string" _value="Epiphany content view component"/>
+ <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
+ <item value="text/html"/>
+ <item value="text/xml"/>
+ <item value="x-directory/webdav"/>
+ <item value="x-directory/webdav-prefer-directory"/>
+ </oaf_attribute>
+ <oaf_attribute name="nautilus:view_as_name" type="string" _value="Web Page (Epiphany)"/>
+ <oaf_attribute name="nautilus:view_as_label" type="string" _value="View as Web Page (Epiphany)"/>
+ <oaf_attribute name="nautilus:viewer_label" type="string" _value="Web Page Viewer (Epiphany)"/>
+</oaf_server>
+
+</oaf_info>
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 000000000..60b11c546
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,29 @@
+SUBDIRS = ui art glade
+
+@INTLTOOL_SERVER_RULE@
+@INTLTOOL_DESKTOP_RULE@
+
+server_in_files = GNOME_Epiphany_Automation.server.in GNOME_Epiphany_NautilusView.server.in
+server_DATA = GNOME_Epiphany_Automation.server GNOME_Epiphany_NautilusView.server
+serverdir = $(libdir)/bonobo/servers
+
+schemadir = $(sysconfdir)/gconf/schemas
+schema_DATA = epiphany.schemas
+
+startheredir = $(pkgdatadir)
+starthere_DATA = start_here.html
+
+EXTRA_DIST = $(glade_DATA)
+
+install-data-local:
+ if test -z "$(DESTDIR)" ; then \
+ for p in $(schema_DATA) ; do \
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/data/$$p; \
+ done \
+ fi
+
+CLEANFILES = GNOME_Epiphany_Automation.server
+
+EXTRA_DIST = $(server_in_files) \
+ $(schema_DATA) \
+ $(starthere_DATA)
diff --git a/data/art/.cvsignore b/data/art/.cvsignore
new file mode 100644
index 000000000..282522db0
--- /dev/null
+++ b/data/art/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/data/art/Makefile.am b/data/art/Makefile.am
new file mode 100644
index 000000000..f4f5c3b5f
--- /dev/null
+++ b/data/art/Makefile.am
@@ -0,0 +1,7 @@
+art_DATA = \
+ epiphany-secure.png \
+ epiphany-unsecure.png
+
+artdir = $(pkgdatadir)/art
+
+EXTRA_DIST = $(art_DATA)
diff --git a/data/art/epiphany-secure.png b/data/art/epiphany-secure.png
new file mode 100644
index 000000000..cbfc2d2b1
--- /dev/null
+++ b/data/art/epiphany-secure.png
Binary files differ
diff --git a/data/art/epiphany-unsecure.png b/data/art/epiphany-unsecure.png
new file mode 100644
index 000000000..5ee7106d9
--- /dev/null
+++ b/data/art/epiphany-unsecure.png
Binary files differ
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in
new file mode 100644
index 000000000..7450fefc7
--- /dev/null
+++ b/data/epiphany.schemas.in
@@ -0,0 +1,627 @@
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/apps/epiphany/general/start_page</key>
+ <applyto>/apps/epiphany/general/start_page</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>start-here:</default>
+ <locale name="C">
+ <short>Home page</short>
+ <long>URL for the user's home page. Displayed on start up
+ and when a new window or tab is created </long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/general/newpage_type</key>
+ <applyto>/apps/epiphany/general/newpage_type</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>New page type</short>
+ <long>Type of page to show when opening a new window or tab. Possible
+ values are: 0 (home page), 1 (last page), 2 (blank)</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/find/match_case</key>
+ <applyto>/apps/epiphany/find/match_case</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Match case for find in page</short>
+ <long>Match case for find in page.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/find/autowrap</key>
+ <applyto>/apps/epiphany/find/autowrap</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Autowrap for find in page</short>
+ <long>For find in page, whether to start again at the beginning after
+ reaching the end of the page</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/filtering/allow_popups</key>
+ <applyto>/apps/epiphany/filtering/allow_popups</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Allow popups</short>
+ <long>Allow sites to open new windows using JavaScript (if JavaScript
+ is enabled).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/use_own_colors</key>
+ <applyto>/apps/epiphany/rendering/use_own_colors</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Use own colors</short>
+ <long>Use your own colors instead of the colors the page
+ requests.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/use_own_fonts</key>
+ <applyto>/apps/epiphany/rendering/use_own_fonts</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Use own fonts</short>
+ <long>Use your own fonts instead of the fonts the page
+ requests.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/background_color</key>
+ <applyto>/apps/epiphany/rendering/background_color</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>#FFFFFF</default>
+ <locale name="C">
+ <short>Default page background color</short>
+ <long>Default page background color in #RRGGBB hex format.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/text_color</key>
+ <applyto>/apps/epiphany/rendering/text_color</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>#000000</default>
+ <locale name="C">
+ <short>Default page text color</short>
+ <long>Default page text color in #RRGGBB hex format.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/visited_link_color</key>
+ <applyto>/apps/epiphany/rendering/visited_link_color</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>#FF0000</default>
+ <locale name="C">
+ <short>Default visited link color</short>
+ <long>Default color for visited links in #RRGGBB hex format.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/unvisited_link_color</key>
+ <applyto>/apps/epiphany/rendering/unvisited_link_color</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>#0000FF</default>
+ <locale name="C">
+ <short>Default unvisited link color</short>
+ <long>Default color for unvisited links in #RRGGBB hex format.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/underline_links</key>
+ <applyto>/apps/epiphany/rendering/underline_links</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Underline links</short>
+ <long>Underline links.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/open_in_tab</key>
+ <applyto>/apps/epiphany/interface/open_in_tab</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Use tabs</short>
+ <long>Open in tabs by default.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/popups_in_tab</key>
+ <applyto>/apps/epiphany/interface/popups_in_tab</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Open popups in tabs</short>
+ <long>Open popups in tabs instead of new windows.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/jumpto_tab</key>
+ <applyto>/apps/epiphany/interface/jumpto_tab</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Jump to new tabs</short>
+ <long>Jump to new tabs.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/show_toolbars_in_fullscreen</key>
+ <applyto>/apps/epiphany/interface/show_toolbars_in_fullscreen</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Show toolbars in full screen mode</short>
+ <long>Show toolbars in full screen mode.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/show_statusbar_in_fullscreen</key>
+ <applyto>/apps/epiphany/interface/show_statusbar_in_fullscreen</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Show statusbar in full screen mode</short>
+ <long>Show statusbar in full screen mode.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/show_sidebar_in_fullscreen</key>
+ <applyto>/apps/epiphany/interface/show_sidebar_in_fullscreen</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Show sidebar in full screen mode</short>
+ <long>Show sidebar in full screen mode.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/show_sidebar</key>
+ <applyto>/apps/epiphany/interface/show_sidebar</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Show sidebar by default</short>
+ <long>Show sidebar by default.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/sidebar_size</key>
+ <applyto>/apps/epiphany/interface/sidebar_size</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>100</default>
+ <locale name="C">
+ <short>Default sidebar size</short>
+ <long>Default sidebar size.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/sidebar_page</key>
+ <applyto>/apps/epiphany/interface/sidebar_page</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>history</default>
+ <locale name="C">
+ <short>Default sidebar page</short>
+ <long>Default sidebar page.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/show_toolbars</key>
+ <applyto>/apps/epiphany/interface/show_toolbars</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Show toolbars by default</short>
+ <long>Show toolbars by default.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/show_statusbar</key>
+ <applyto>/apps/epiphany/interface/show_statusbar</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Show statusbar by default</short>
+ <long>Show statusbar by default.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/filtering/image_loading_type</key>
+ <applyto>/apps/epiphany/filtering/image_loading_type</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>When to load images</short>
+ <long>When to load images. Possible values are 0 (always), 1 (from
+ current server only), 2 (never)</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/filtering/animate_type</key>
+ <applyto>/apps/epiphany/filtering/animate_type</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Image animation type</short>
+ <long>Image animation type. Possible values are 0 (continuously), 1
+ (once through), 2 (never)</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/default_charset</key>
+ <applyto>/apps/epiphany/rendering/default_charset</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>Western (ISO-8859-1)</default>
+ <locale name="C">
+ <short>Default charset</short>
+ <long>Default charset.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/default_font</key>
+ <applyto>/apps/epiphany/rendering/default_font</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Default font type</short>
+ <long>Default font type. Possible values are 0 (serif), 1
+ (sans-serif)</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/spinner_theme</key>
+ <applyto>/apps/epiphany/interface/spinner_theme</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>gnome</default>
+ <locale name="C">
+ <short>Default spinner theme</short>
+ <long>Default spinner theme</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/interface/toolbar_setup</key>
+ <applyto>/apps/epiphany/interface/toolbar_setup</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>back=std_toolitem(item=back);back_history=navigation_history(direction=back);forward=std_toolitem(item=forward);forward_history=navigation_history(direction=forward);stop=std_toolitem(item=stop);reload=std_toolitem(item=reload);home_separator=separator;home=std_toolitem(item=home);favicons_separator=separator;favicon=favicon;location=location;spinner=spinner;</default>
+ <locale name="C">
+ <short>Toolbar setup</short>
+ <long>The list of controls that will be present in the toolbar. You should edit
+ this setting with the toolbar editor unless you know what you are doing.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/downloader/keep_open</key>
+ <applyto>/apps/epiphany/downloader/keep_open</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Keep downloader open after download finished</short>
+ <long>Keep downloader open after all downloads have finished.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/filtering/java_enabled</key>
+ <applyto>/apps/epiphany/filtering/java_enabled</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Allow Java</short>
+ <long>Allow Java.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/filtering/javascript_enabled</key>
+ <applyto>/apps/epiphany/filtering/javascript_enabled</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Allow JavaScript</short>
+ <long>Allow JavaScript.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/network/no_proxies_for</key>
+ <applyto>/apps/epiphany/network/no_proxies_for</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short>No proxy for</short>
+ <long>List of domains for wherefore not to use the proxy, comma
+ delimited</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/network/disk_cache_size</key>
+ <applyto>/apps/epiphany/network/disk_cache_size</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>50000</default>
+ <locale name="C">
+ <short>Size of disk cache</short>
+ <long>Size of disk cache, in KB.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/network/mem_cache_size</key>
+ <applyto>/apps/epiphany/network/mem_cache_size</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>4096</default>
+ <locale name="C">
+ <short>Size of memory cache</short>
+ <long>Size of memory cache, in KB.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/network/cache_compare</key>
+ <applyto>/apps/epiphany/network/cache_compare</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>3</default>
+ <locale name="C">
+ <short>When to compare cached copy</short>
+ <long>When to compare cached copy to web copy. Possible values are 0
+ (once per session), 1 (every time), 2 (never), 3 (automatic).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/lang</key>
+ <applyto>/apps/epiphany/rendering/lang</applyto>
+ <owner>epiphany</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <default>[en]</default>
+ <locale name="C">
+ <short>Languages</short>
+ <long>Preferred languages, two letter codes.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/filterin/passwords_save</key>
+ <applyto>/apps/epiphany/filtering/passwords_save</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Save passwords</short>
+ <long>Save passwords.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/history/expire</key>
+ <applyto>/apps/epiphany/history/expire</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>30</default>
+ <locale name="C">
+ <short>Expire history</short>
+ <long>Expire history after how many days.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/history/search_time</key>
+ <applyto>/apps/epiphany/history/search_time</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>1</default>
+ <locale name="C">
+ <short>History search time</short>
+ <long>Show only history entries from a particular time. Possible
+ values are 0 (all items), 1 (today), 2 (yesterday), 3 (two days ago), 4
+ (this week), 5 (this month).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/top_margin</key>
+ <applyto>/apps/epiphany/print/top_margin</applyto>
+ <owner>epiphany</owner>
+ <type>float</type>
+ <default>0.5</default>
+ <locale name="C">
+ <short>Printing top margin</short>
+ <long>Printing top margin (in inches).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/bottom_margin</key>
+ <applyto>/apps/epiphany/print/bottom_margin</applyto>
+ <owner>epiphany</owner>
+ <type>float</type>
+ <default>0.5</default>
+ <locale name="C">
+ <short>Printing bottom margin</short>
+ <long>Printing bottom margin (in inches).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/left_margin</key>
+ <applyto>/apps/epiphany/print/left_margin</applyto>
+ <owner>epiphany</owner>
+ <type>float</type>
+ <default>0.5</default>
+ <locale name="C">
+ <short>Printing left margin</short>
+ <long>Printing left margin (in inches).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/right_margin</key>
+ <applyto>/apps/epiphany/print/right_margin</applyto>
+ <owner>epiphany</owner>
+ <type>float</type>
+ <default>0.5</default>
+ <locale name="C">
+ <short>Printing right margin</short>
+ <long>Printing right margin (in inches).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/page_title_toggle</key>
+ <applyto>/apps/epiphany/print/page_title_toggle</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Whether to print the page title in the header.</short>
+ <long>Whether to print the page title in the header.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/page_url_toggle</key>
+ <applyto>/apps/epiphany/print/page_url_toggle</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Whether to print the page URL in the header</short>
+ <long>Whether to print the page URL in the header</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/date_toggle</key>
+ <applyto>/apps/epiphany/print/date_toggle</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Whether to print the date in the footer.</short>
+ <long>Whether to print the date in the footer.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/page_numbers_toggle</key>
+ <applyto>/apps/epiphany/print/page_numbers_toggle</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Whether to print the page numbers (x of total) in the footer.</short>
+ <long>Whether to print the page numbers (x of total) in the footer.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/printer</key>
+ <applyto>/apps/epiphany/print/printer</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>lpr</default>
+ <locale name="C">
+ <short>Printer name</short>
+ <long>Printer name.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/file</key>
+ <applyto>/apps/epiphany/print/file</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <locale name="C">
+ <short>Filename to print to</short>
+ <long>Filename to print to.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/printon</key>
+ <applyto>/apps/epiphany/print/printon</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Print range</short>
+ <long>Print range: 0 (all pages), 1 (specific range).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/print/paper</key>
+ <applyto>/apps/epiphany/print/paper</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Paper type</short>
+ <long>Paper type: 0 (Letter), 1 (Legal), 2 (Executive), 3 (A4).</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/directories/opendir</key>
+ <applyto>/apps/epiphany/directories/opendir</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>~</default>
+ <locale name="C">
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/directories/savedir</key>
+ <applyto>/apps/epiphany/directories/savedir</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>~</default>
+ <locale name="C">
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/directories/saveimagedir</key>
+ <applyto>/apps/epiphany/directories/saveimagedir</applyto>
+ <owner>epiphany</owner>
+ <type>string</type>
+ <default>~</default>
+ <locale name="C">
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/rendering/autodetect_charset</key>
+ <applyto>/apps/epiphany/rendering/autodetect_charset</applyto>
+ <owner>epiphany</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
+
diff --git a/data/glade/.cvsignore b/data/glade/.cvsignore
new file mode 100644
index 000000000..06ac86832
--- /dev/null
+++ b/data/glade/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+*.gladep
diff --git a/data/glade/Makefile.am b/data/glade/Makefile.am
new file mode 100644
index 000000000..1013895d5
--- /dev/null
+++ b/data/glade/Makefile.am
@@ -0,0 +1,10 @@
+glade_DATA = \
+ epiphany.glade \
+ prompts.glade \
+ toolbar-editor.glade \
+ prefs-dialog.glade \
+ print.glade
+
+gladedir = $(pkgdatadir)/glade
+
+EXTRA_DIST = $(glade_DATA)
diff --git a/data/glade/epiphany.glade b/data/glade/epiphany.glade
new file mode 100644
index 000000000..520d9217e
--- /dev/null
+++ b/data/glade/epiphany.glade
@@ -0,0 +1,1582 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="history_dialog">
+ <property name="border_width">6</property>
+ <property name="height_request">400</property>
+ <property name="title" translatable="yes">History</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="history_dialog_b">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="history_clear_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="history_clear_button_clicked_cb"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment8">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox86">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="stock">gtk-clear</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1223">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">C_lear</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="history_ok_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-7</property>
+ <signal name="clicked" handler="history_ok_button_clicked_cb"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox98">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox41">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label224">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Find:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">history_entry</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="history_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ <signal name="changed" handler="history_entry_changed_cb" last_modification_time="Sun, 27 Oct 2002 13:43:51 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label225">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Time:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">history_time_optionmenu</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="history_time_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">0</property>
+ <signal name="changed" handler="history_time_optionmenu_changed_cb" last_modification_time="Wed, 01 May 2002 11:40:31 GMT"/>
+
+ <child internal-child="menu">
+ <widget class="GtkMenu" id="convertwidget1">
+ <property name="visible">True</property>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Ever</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Today</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Last two days</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Last three days</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Week</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Month</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1136">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="history_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkDialog" id="find_dialog">
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Find text...</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area4">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="BClose">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="find_close_button_clicked_cb"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="back_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="find_prev_button_clicked_cb"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment7">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox85">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-back</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1222">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Previous</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="forward_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="find_next_button_clicked_cb"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment6">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox84">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-forward</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1221">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Next</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox131">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox109">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox72">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label63">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Find text in the document:&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">7.45058e-09</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GnomeEntry" id="find_gnome_entry">
+ <property name="visible">True</property>
+ <property name="history_id">FindEntry</property>
+ <property name="max_saved">10</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="find_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ <signal name="activate" handler="find_entry_activate_cb"/>
+ <signal name="changed" handler="find_entry_changed_cb"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="case_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Match upper/lower case</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="find_check_toggled_cb" last_modification_time="Wed, 03 Apr 2002 12:46:24 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="wrap_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Automatically _wrap around</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="find_check_toggled_cb" last_modification_time="Wed, 03 Apr 2002 12:47:04 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkWindow" id="download_manager_dialog">
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Downloading</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <signal name="delete_event" handler="download_dialog_delete_cb"/>
+
+ <child>
+ <widget class="GtkVBox" id="vbox106">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox10">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">8</property>
+
+ <child>
+ <widget class="GtkButton" id="open_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-open</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="download_dialog_open_cb" last_modification_time="Tue, 04 Jun 2002 18:01:15 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="pause_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Pause</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="download_dialog_pause_cb" last_modification_time="Sat, 01 Jun 2002 23:54:37 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="resume_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Resume</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="download_dialog_resume_cb" last_modification_time="Sun, 02 Jun 2002 00:08:23 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="abort_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-stop</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="download_dialog_abort_cb" last_modification_time="Sat, 01 Jun 2002 23:54:50 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox107">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1134">
+ <property name="height_request">100</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="clist">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox82">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="keep_open_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Keep the dialog open</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="details_togglebutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <signal name="toggled" handler="download_dialog_details_cb" last_modification_time="Sat, 01 Jun 2002 23:52:31 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox83">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-info</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1220">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Download _details...</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="details_separator">
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="details_frame">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkTable" id="details_table">
+ <property name="visible">True</property>
+ <property name="n_rows">6</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1142">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Location:&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1143">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;File:&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1211">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Status:&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1212">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Time Elapsed:&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1213">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Time Remaining:&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="details_elapsed">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="details_remaining">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="details_status">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkProgressBar" id="details_progress">
+ <property name="visible">True</property>
+ <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
+ <property name="fraction">0</property>
+ <property name="pulse_step">0.1</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkDialog" id="pdm_dialog">
+ <property name="border_width">7</property>
+ <property name="width_request">400</property>
+ <property name="height_request">300</property>
+ <property name="title" translatable="yes">Personal data manager</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox27">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area27">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="closebutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-7</property>
+ <signal name="clicked" handler="pdm_dialog_close_button_clicked_cb" last_modification_time="Mon, 17 Jun 2002 11:00:39 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkNotebook" id="notebook3">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">True</property>
+ <property name="show_border">True</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">False</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox87">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1139">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="cookies_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_START</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkButton" id="cookies_remove_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="cookies_properties_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-properties</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="pdm_dialog_cookies_properties_button_clicked_cb" last_modification_time="Thu, 20 Jun 2002 08:12:23 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1227">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Cookies</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox88">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1140">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="passwords_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox2">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_START</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkButton" id="passwords_remove_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1228">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Passwords</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkDialog" id="mime_ask_action_dialog">
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Choose the file type action</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox28">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area28">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="mime_ask_dialog_save">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-save</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="mime_ask_dialog_save_clicked_cb" last_modification_time="Sun, 01 Sep 2002 13:39:41 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="mime_ask_dialog_cancel">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ <signal name="clicked" handler="mime_ask_dialog_cancel_clicked_cb" last_modification_time="Sun, 01 Sep 2002 13:08:43 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="mime_ask_dialog_open">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-open</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="mime_ask_dialog_open_clicked_cb" last_modification_time="Sun, 01 Sep 2002 13:09:36 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox135">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox95">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkImage" id="image8">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-question</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox136">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1231">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;What do you want to do with this file?
+&lt;/span&gt;
+It's not possible to view this file type directly in the browser:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">True</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox93">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1235">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="mime_ask_action_icon">
+ <property name="visible">True</property>
+ <property name="stock">gtk-justify-center</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="mime_ask_action_description">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="mime_ask_dialog_choice_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">You can open it with another application or save it on disk.</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">True</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/data/glade/prefs-dialog.glade b/data/glade/prefs-dialog.glade
new file mode 100644
index 000000000..4042ddbcc
--- /dev/null
+++ b/data/glade/prefs-dialog.glade
@@ -0,0 +1,3083 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkWindow" id="general_page_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="general_page_box">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox152">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1238">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Home page&lt;/b&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">homepage_entry</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox136">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1239">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox154">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox138">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1243">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Location:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">homepage_entry</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="homepage_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox12">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Set to _Current Page</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="prefs_homepage_current_button_clicked_cb"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button9">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Set to _Blank Page</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="prefs_homepage_blank_button_clicked_cb" last_modification_time="Tue, 14 May 2002 10:37:08 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox153">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1240">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;On New Page&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox137">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1241">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox155">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="new_page_show_homepage">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show hom_e page</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton32">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show la_st page</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">new_page_show_homepage</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton33">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show blan_k page</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">new_page_show_homepage</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox156">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1242">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Language&lt;/b&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table85">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1205">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Autodetec_t encoding:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">autocharset_optionmenu</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1206">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Default encoding:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">default_charset_optionmenu</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1208">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Lan_guage:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">language_optionmenu</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="language_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">-1</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="default_charset_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">-1</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="autocharset_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">0</property>
+
+ <child internal-child="menu">
+ <widget class="GtkMenu" id="menu6">
+ <property name="visible">True</property>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem39">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Off</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem40">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Chinese</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem41">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">East asian</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem42">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Japanese</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem43">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Korean</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem44">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Russian</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem45">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Simplified Chinese</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem46">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Traditional Chinese</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem47">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Ukrainian</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-select-font</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox10">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkButton" id="language_more_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_More...</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="prefs_language_more_button_clicked_cb" last_modification_time="Tue, 14 May 2002 11:07:13 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkWindow" id="appearance_page_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window2</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="appearance_page_box">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox157">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1244">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Fonts&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox139">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1245">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table70">
+ <property name="visible">True</property>
+ <property name="n_rows">7</property>
+ <property name="n_columns">4</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1132">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Siz_e:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">fixed_size_spinbutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="fixed_size_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1131">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Si_ze:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">variable_size_spinbutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="variable_size_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1133">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Proportional:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">proportional_optionmenu</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1134">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Serif:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">combo-entry1</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1135">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">S_ans serif:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">combo-entry2</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1138">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Monospace:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">combo-entry5</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1121">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Language encoding:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">optionmenu2</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="optionmenu2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">0</property>
+ <signal name="changed" handler="fonts_language_optionmenu_changed_cb" last_modification_time="Fri, 17 May 2002 10:44:00 GMT"/>
+
+ <child internal-child="menu">
+ <widget class="GtkMenu" id="menu2">
+ <property name="visible">True</property>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem18">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Western</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem19">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Central European</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem20">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Japanese</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem21">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Traditional Chinese</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem22">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Simplified Chinese</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem23">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Korean</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem24">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Cyrillic</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem25">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Baltic</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem26">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Greek</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem27">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Turkish</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem28">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Unicode</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem29">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Thai</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem30">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Hebrew</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="menuitem31">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Arabic</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="proportional_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">0</property>
+
+ <child>
+ <widget class="GtkMenu" id="menu3">
+
+ <child>
+ <widget class="GtkMenuItem" id="serif1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Serif</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="sans_serif1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Sans Serif</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox133">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="use_fonts_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Always us_e these fonts</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1217">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Min_imum font size:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">min_size_spinbutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="min_size_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="serif_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">False</property>
+ <property name="allow_empty">True</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="combo-entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list1">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="sansserif_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">False</property>
+ <property name="allow_empty">True</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="combo-entry2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list2">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="monospace_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">False</property>
+ <property name="allow_empty">True</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="combo-entry5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list5">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1275">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox162">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox158">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1246">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Colors&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox140">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1247">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox174">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox163">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GnomeColorPicker" id="background_cpick">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="dither">True</property>
+ <property name="use_alpha">False</property>
+ <property name="title" translatable="yes">Pick the background color</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1250">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Background</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox165">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GnomeColorPicker" id="text_cpick">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="dither">True</property>
+ <property name="use_alpha">False</property>
+ <property name="title" translatable="yes">Pick the text color</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1251">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Text</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="use_syscolors_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use s_ystem colors</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="use_colors_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Al_ways use these colors</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox176">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1280">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Links&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox166">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1281">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox177">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox167">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GnomeColorPicker" id="unvisited_cpick">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="dither">True</property>
+ <property name="use_alpha">False</property>
+ <property name="title" translatable="yes">Pick the unvisited link color</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1249">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Unvisited link</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox168">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GnomeColorPicker" id="visited_cpick">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="dither">True</property>
+ <property name="use_alpha">False</property>
+ <property name="title" translatable="yes">Pick the visited link color</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1248">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Visited link</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkWindow" id="ui_page_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="ui_page_box">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox159">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1252">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Tabs&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox145">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1253">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox160">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="open_in_tabs_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Open in tabs by default</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="jump_to_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Jump to new tabs automatically</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="popups_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Open _popups in tabs</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox161">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1254">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Spinner&lt;/b&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox146">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1255">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1131">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GnomeIconList" id="spinners_iconlist">
+ <property name="height_request">160</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="selection_mode">GTK_SELECTION_SINGLE</property>
+ <property name="icon_width">78</property>
+ <property name="row_spacing">4</property>
+ <property name="column_spacing">2</property>
+ <property name="text_spacing">2</property>
+ <property name="text_editable">False</property>
+ <property name="text_static">False</property>
+ <signal name="select_icon" handler="spinners_iconlist_select_icon_cb" last_modification_time="Sat, 18 May 2002 10:07:15 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkWindow" id="network_page_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="network_page_box">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox162">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1256">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Caches&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox147">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1257">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox178">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox179">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1282">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Compare page:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="cache_compare_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Once per _session</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton54">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">E_very time</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cache_compare_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton55">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Never</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cache_compare_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton56">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Automatically</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cache_compare_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table77">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">4</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1167">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">kB</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1168">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">kB</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1170">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Dis_k cache:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">disk_cache_spin</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1171">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Memor_y cache:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">memory_cache_spin</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="memory_cache_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 1e+06 1000 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="disk_cache_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 1e+06 1000 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Clear _Memory Cache</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="prefs_clear_memory_cache_button_clicked_cb"/>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Clear _Disk Cache</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="prefs_clear_disk_cache_button_clicked_cb"/>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkWindow" id="filtering_page_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window2</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="filtering_page_box">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox165">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1261">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Cookies&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox150">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1264">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox168">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="cookies_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Always accept</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton51">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Accept _from current server only</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cookies_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton52">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Never accept</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cookies_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="warn_cookie_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Warn before accepting a cookie</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="session_cookie_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Coo_kies expire at the end of the session</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox164">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1260">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Images&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox149">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1263">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox167">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="images_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Always load</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton48">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Load from current server only</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">images_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton49">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Never load</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">images_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox166">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1262">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Others&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox151">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1265">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table90">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="allow_java_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow _Java (requires plugin)</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="allow_js_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow Java_Script</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="allow_popups_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow _popups</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="allow_statusbar_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow statusbar _messages</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="remember_passwords_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Remember passwords</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkDialog" id="languages_dialog">
+ <property name="border_width">6</property>
+ <property name="height_request">300</property>
+ <property name="title" translatable="yes">Languages editor</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="add_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="remove_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button12">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-7</property>
+ <signal name="clicked" handler="language_editor_close_button_cb" last_modification_time="Thu, 16 May 2002 18:58:11 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox146">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox132">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1216">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Language</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="languages_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">-1</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1130">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="languages_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/data/glade/print.glade b/data/glade/print.glade
new file mode 100644
index 000000000..66a55bef0
--- /dev/null
+++ b/data/glade/print.glade
@@ -0,0 +1,1573 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="print_dialog">
+ <property name="border_width">7</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Print</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox8">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area8">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="preview_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-print-preview</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">50</property>
+ <signal name="clicked" handler="print_preview_button_cb"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="cancel_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ <signal name="clicked" handler="print_cancel_button_cb"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="print_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-print</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ <signal name="clicked" handler="print_ok_button_cb"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkNotebook" id="print_notebook">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">True</property>
+ <property name="show_border">True</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">False</property>
+ <property name="tab_hborder">2</property>
+ <property name="tab_vborder">2</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox127">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox128">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label251">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Printer&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox70">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label252">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table47">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="printer_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Printer</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="file_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_File</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">printer_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="printer_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes">lpr</property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GnomeFileEntry" id="fileentry1">
+ <property name="visible">True</property>
+ <property name="max_saved">10</property>
+ <property name="browse_dialog_title" translatable="yes">Choose a file to print to</property>
+ <property name="directory_entry">False</property>
+ <property name="modal">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="file_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox129">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label253">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Pages range&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox71">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label254">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table49">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="all_pages_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_All pages</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="pages_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Pa_ges</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">all_pages_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox49">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkLabel" id="label241">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">from:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="from_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label242">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">to:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="to_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Selection</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">all_pages_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label249">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">General</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox131">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox132">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label257">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Size&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox73">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label259">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox84">
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="letter_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Letter (8.5&quot; x 11&quot;)</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="legal_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">L_egal (8.5&quot; x 14&quot;)</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">letter_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="executive_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">E_xecutive (7.25&quot; x 10.5&quot;)</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">letter_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="A4_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">A_4 (8.27&quot; x 11.69&quot;)</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">letter_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dnd</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox133">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label258">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Orientation&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox74">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label260">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox135">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="orient_p_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">P_ortrait</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="orient_l_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Lan_dscape</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">orient_p_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label250">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Paper Details</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox144">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox84">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox137">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label261">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Margins (inches)&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox78">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label271">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table48">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label238">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Bottom</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">bottom_spinbutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label239">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Le_ft</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">left_spinbutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label240">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Right</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">right_spinbutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label237">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Top</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">top_spinbutton</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="bottom_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0.6 0 100 0.1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="left_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0.5 0 100 0.1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="top_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0.3 0 100 0.1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="right_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0.5 0 100 0.1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox141">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label272">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Colors&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox80">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label273">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox142">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="print_color_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Color</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="print_grayscale_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">G_rayscale</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">print_color_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-select-color</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox85">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox140">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label269">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Footers&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox77">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label270">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox125">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="print_page_numbers_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Page nu_mbers</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="print_date_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Date</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox138">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label267">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Headers&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox76">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label268">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox124">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="print_page_title_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">P_age Title</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="print_page_url_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Page _URL</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label276">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Appearance</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/data/glade/prompts.glade b/data/glade/prompts.glade
new file mode 100644
index 000000000..e13a51e70
--- /dev/null
+++ b/data/glade/prompts.glade
@@ -0,0 +1,722 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="prompt_user_pass_dialog">
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes"></property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="default_width">350</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox9">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area9">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button51">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button49">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table60">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="check_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">False</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="username_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1029">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Password</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1028">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Username</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_FILL</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="pixmap">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-question</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkDialog" id="prompt_dialog">
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes"></property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="default_width">350</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox11">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area11">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button57">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button55">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table55">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkEntry" id="entry">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="check_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">expand</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="pixmap">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-question</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkDialog" id="prompt_pass_dialog">
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes"></property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="default_width">350</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox12">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area12">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button60">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button58">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_FILL</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table56">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1026">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Password</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="check_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">expand</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="pixmap">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-question</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">False</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkDialog" id="select_dialog">
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes"></property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox16">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area16">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button70">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button71">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table63">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">DYNAMIC</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_FILL</property>
+ <property name="wrap">True</property>
+ <property name="selectable">False</property>
+ <property name="xalign">7.45058e-09</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="pixmap">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-question</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">shrink|fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/data/glade/toolbar-editor.glade b/data/glade/toolbar-editor.glade
new file mode 100644
index 000000000..b5c4704d3
--- /dev/null
+++ b/data/glade/toolbar-editor.glade
@@ -0,0 +1,418 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="toolbar-editor-dialog">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Toolbar Editor</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="width_request">450</property>
+ <property name="height_request">350</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="toolbar-editor-revert-button">
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-revert-to-saved</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Reset to defaults</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="toolbar-editor-undo-button">
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-undo</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="toolbar-editor-close-button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;_Available Controls&lt;/b&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="toolbar-editor-available-view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">0</property>
+
+ <child>
+ <widget class="GtkButton" id="toolbar-editor-up-button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+
+ <child>
+ <widget class="GtkArrow" id="arrow2">
+ <property name="visible">True</property>
+ <property name="arrow_type">GTK_ARROW_UP</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="toolbar-editor-right-button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+
+ <child>
+ <widget class="GtkArrow" id="arrow1">
+ <property name="visible">True</property>
+ <property name="arrow_type">GTK_ARROW_RIGHT</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="toolbar-editor-down-button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+
+ <child>
+ <widget class="GtkArrow" id="arrow4">
+ <property name="visible">True</property>
+ <property name="arrow_type">GTK_ARROW_DOWN</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="toolbar-editor-left-button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+
+ <child>
+ <widget class="GtkArrow" id="arrow3">
+ <property name="visible">True</property>
+ <property name="arrow_type">GTK_ARROW_LEFT</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">4</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Cu_rrent Controls&lt;/b&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="toolbar-editor-current-view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/data/start_here.html b/data/start_here.html
new file mode 100644
index 000000000..73a0e908e
--- /dev/null
+++ b/data/start_here.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+</head>
+<body>
+<h1>Welcome ...</h1>
+<h2>Smart Bookmarks</h2>
+<p>
+Right click the icon and choose "Add Bookmark" from the menu list.
+</p>
+<dl>
+<li>
+<a type="text/smartbookmark" href="http://www.google.com/" rel="http://www.google.com/search?q=%s" title="Search the web - Google">
+Search the web - Google
+</a>
+</li>
+<li>
+<a type="text/smartbookmark" href="http://images.google.com/" rel="http://images.google.com/images?q=%s" title="Search images - Google">
+Search images - Google
+</a>
+</li>
+</ol>
+</body>
+</html>
diff --git a/data/ui/.cvsignore b/data/ui/.cvsignore
new file mode 100644
index 000000000..765506f45
--- /dev/null
+++ b/data/ui/.cvsignore
@@ -0,0 +1,4 @@
+Makefile
+Makefile.in
+epiphany-ui.xml
+nautilus-epiphany-view.xml
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
new file mode 100644
index 000000000..658ebf3f1
--- /dev/null
+++ b/data/ui/Makefile.am
@@ -0,0 +1,11 @@
+uixmldir = $(datadir)/gnome-2.0/ui
+uixml_in_files = epiphany-ui.xml.in \
+ nautilus-epiphany-view.xml.in
+
+uixml_DATA = $(uixml_in_files:.xml.in=.xml)
+
+@INTLTOOL_XML_RULE@
+
+EXTRA_DIST = $(uixml_in_files)
+
+CLEANFILES = $(uixml_DATA)
diff --git a/data/ui/epiphany-ui.xml.in b/data/ui/epiphany-ui.xml.in
new file mode 100644
index 000000000..cb966a4e4
--- /dev/null
+++ b/data/ui/epiphany-ui.xml.in
@@ -0,0 +1,454 @@
+<Root>
+
+<commands>
+ <cmd name="FileOpen" _label="Open"
+ _tip="Open a file" pixtype="stock" pixname="gtk-open" accel="*Control*O"/>
+
+ <cmd name="FileSaveAs" _label="Save As"
+ _tip="Save the current file with a different name"
+ pixtype="stock" pixname="gtk-save-as"
+ accel="*Shift**Control*S"/>
+
+ <cmd name="FilePrint" _label="Print"
+ _tip="Print the current file" pixtype="stock" pixname="gtk-print"
+ accel="*Control*P"/>
+
+ <cmd name="FileCloseTab" _tip="Close the current tab"
+ pixtype="stock" pixname="gtk-close"/>
+
+ <cmd name="FileCloseWindow" _tip="Close the current window"/>
+
+ <cmd name="EditCut" _label="Cut" _tip="Cut the selection"
+ pixtype="stock" pixname="gtk-cut"/>
+
+ <cmd name="EditCopy" _label="Copy"
+ _tip="Copy the selection" pixtype="stock" pixname="gtk-copy"/>
+
+ <cmd name="EditPaste" _label="Paste"
+ _tip="Paste the clipboard" pixtype="stock" pixname="gtk-paste"/>
+
+ <cmd name="EditSelectAll" _label="Select All" _tip="Select the entire document"
+ accel="*Control*A"/>
+
+ <cmd name="EditFind" _label="Find" _tip="Search for a string"
+ pixtype="stock" pixname="gtk-find" accel="*Control*F"/>
+
+ <cmd name="Zoom In" _label="Zoom In"
+ _tip="Show the contents in more detail"/>
+ <cmd name="Zoom Out" _label="Zoom Out"
+ _tip="Show the contents in less detail"/>
+ <cmd name="Zoom Normal" _label="Normal Size"
+ _tip="Show the contents at the normal size"/>
+
+ <cmd name="SettingsPreferences" _label="Preferences" _tip="Configure the application"
+ pixtype="stock" pixname="gtk-preferences"/>
+
+ <cmd name="SettingsToolbarEditor" _label="Toolbar" _tip="Edit the main toolbar"/>
+
+ <cmd name="HelpContents" _label="Contents" _tip="Open the Epiphany manual"
+ accel="F1"/>
+
+ <cmd name="About" _label="About..." _tip="About this application"
+ pixtype="stock" pixname="About"/>
+
+ <cmd name="BookmarksAddDefault" _label="Add bookmark"
+ _tip="Add a bookmark to the default folder"/>
+
+ <cmd name="BookmarksEdit" _label="Edit bookmarks"
+ _tip="Open a bookmarks editor"/>
+
+ <cmd name="GoBack" _label="_Back"
+ sensitive="0"/>
+
+ <cmd name="GoUp" _label="_Up"
+ sensitive="0"/>
+
+ <cmd name="GoHome" _label="_Home"/>
+
+ <cmd name="GoMyportal" _label="_My portal"/>
+
+ <cmd name="GoForward" _label="_Forward"
+ sensitive="0"/>
+
+ <cmd name="GoStop" _label="_Stop"
+ sensitive="0"
+ _tip="Stop current data transfer"/>
+
+ <cmd name="GoReload" _label="_Reload"
+ _tip="Display the latest content of the current page"/>
+
+ <cmd name="GoGo" _label="_Go"
+ _tip="Load the URL in the location entry"/>
+
+ <cmd name="EPOpenInNewWindow" _label="Open in New Window"/>
+
+ <cmd name="EPOpenInNewTab" _label="Open in New Tab"/>
+
+ <cmd name="EPCopyLinkLocation" _label="Copy Link Location"/>
+
+ <cmd name="EPCopyEmail" _label="Copy Email Address"/>
+
+ <cmd name="EPDownloadLink" _label="Download Link"/>
+
+ <cmd name="EPAddBookmark" _label="Add Bookmark"/>
+
+ <cmd name="EPOpenImage" _label="Open Image"/>
+
+ <cmd name="EPOpenImageInNewWindow" _label="Open Image in New Window"/>
+
+ <cmd name="EPOpenImageInNewTab" _label="Open Image in New Tab"/>
+
+ <cmd name="EPSaveImageAs" _label="Save Image As..."/>
+
+ <cmd name="EPSetImageAsBackground" _label="Use Image as Background"/>
+
+ <cmd name="EPCopyImageLocation" _label="Copy Image Location"/>
+
+ <cmd name="DPCopyLocation" _label="Copy Page location"/>
+
+ <cmd name="DPOpenFrame" _label="Open Frame"/>
+
+ <cmd name="DPOpenFrameInNewWindow" _label="Open Frame in New Window"/>
+
+ <cmd name="DPOpenFrameInNewTab" _label="Open Frame in New Tab"/>
+
+ <cmd name="DPReloadFrame" _label="Reload Frame"/>
+
+ <cmd name="DPAddFrameBookmark" _label="Add Bookmark for Frame"/>
+
+ <cmd name="DPSavePageAs" _label="Save Page As..."/>
+
+ <cmd name="DPSaveBackgroundAs" _label="Save Background As..."/>
+
+ <cmd name="DPAddPageBookmark" verb="Add Bookmark"/>
+
+ <cmd name="PPVGotoFirst" _label="First"/>
+
+ <cmd name="PPVGotoLast" _label="Last"/>
+
+ <cmd name="PPVGoBack" _label="Previous"/>
+
+ <cmd name="PPVGoForward" _label="Next"/>
+
+</commands>
+
+<keybindings>
+ <accel name="*Control*S" verb="FileSaveAs"/>
+</keybindings>
+
+<menu>
+
+<submenu name="File" _label="_File">
+
+ <menuitem name="FileNewWindow" verb=""
+ _label="_New Window"
+ pixtype="stock" pixname="gtk-new"
+ accel="*Control*n"/>
+
+ <menuitem name="FileNewTab" verb="" _label="New _Tab" accel="*Control*t"/>
+
+ <menuitem name="FileOpen" verb="" _label="_Open..."/>
+
+ <separator/>
+
+ <menuitem name="FileSaveAs" verb="" _label="Save _As..."/>
+
+ <separator/>
+
+ <menuitem name="FilePrint" verb="" _label="_Print..."/>
+ <menuitem name="FileSendTo" verb=""
+ pixtype="stock" pixname="epiphany-send-link"
+ _label="S_end To..."/>
+
+ <separator/>
+
+ <menuitem name="BookmarksAddDefault" verb="" _label="_Add Bookmark"
+ _tip="Add a bookmark for the current location to the default folder"
+ pixtype="stock" pixname="gtk-add" accel="*Control*d"/>
+
+ <separator/>
+
+ <menuitem name="FileCloseTab" verb="" _label="_Close Tab" accel="*Control*W"/>
+
+ <menuitem name="FileCloseWindow" verb="" _label="Close _Window" accel="*Shift**Control*W"/>
+
+</submenu>
+
+<submenu name="Edit" _label="_Edit">
+
+ <menuitem name="EditCut" verb="" _label="Cu_t" accel="*Control*X"/>
+
+ <menuitem name="EditCopy" verb="" _label="_Copy" accel="*Control*c"/>
+
+ <menuitem name="EditPaste" verb="" _label="_Paste" accel="*Control*v"/>
+
+ <separator/>
+
+ <menuitem name="EditSelectAll" verb="" _label="Select _All"/>
+
+ <separator/>
+
+ <menuitem name="EditFind" verb="" _label="_Find..."/>
+ <menuitem name="EditFindNext" verb=""
+ accel="*Control*G" _label="Find Ne_xt"/>
+ <menuitem name="EditFindPrev" verb=""
+ accel="*Shift**Control*G" _label="Find Pre_vious"/>
+
+ <separator/>
+
+ <menuitem name="PDM" verb="ToolsPDM" _label="P_ersonal Data"/>
+
+ <menuitem name="EditToolbar"
+ _label="T_oolbar"
+ verb="SettingsToolbarEditor"/>
+
+ <menuitem name="EditPrefs"
+ _label="P_references"
+ _tip="Edit Ephy preferences"
+ pixtype="stock" pixname="gtk-preferences"
+ verb="EditPrefs"/>
+</submenu>
+
+<submenu name="View" _label="_View">
+
+ <menuitem name="GoStop"
+ pixtype="stock" pixname="gtk-stop"
+ verb="" accel="Escape"/>
+
+ <menuitem name="GoReload"
+ pixtype="stock" pixname="gtk-refresh"
+ verb="" accel="*Control*R"/>
+
+ <separator/>
+
+ <menuitem name="View Toolbar" id="View Toolbar" type="toggle"
+ _label="_Toolbar" verb="" accel="*Shift**Control*T"/>
+
+ <menuitem name="View Statusbar" id="View Statusbar"
+ type="toggle" _label="St_atusbar" verb=""/>
+
+ <menuitem name="View Fullscreen" id="View Fullscreen"
+ type="toggle" _label="_Fullscreen" verb="" accel="F11"/>
+
+ <separator/>
+
+ <menuitem name="Zoom In"
+ _label="Zoom _In" accel="*Control*plus"
+ pixtype="stock" pixname="zoom-in"
+ verb="Zoom In"/>
+
+ <menuitem name="Zoom Out"
+ _label="Zoom _Out" accel="*Control*minus"
+ pixtype="stock" pixname="zoom-out"
+ verb="Zoom Out"/>
+
+ <menuitem name="Zoom Normal"
+ _label="_Normal Size"
+ pixtype="stock" pixname="zoom-100"
+ verb="Zoom Normal"/>
+
+ <separator/>
+
+ <placeholder name="EncodingMenuPlaceholder"/>
+
+ <menuitem name="Page Source"
+ _label="_Page Source"
+ verb="ViewPageSource"/>
+
+</submenu>
+
+<submenu name="Go" _label="_Go">
+ <menuitem name="GoBack"
+ pixtype="stock" pixname="gtk-go-back"
+ verb="" accel="*Alt*Left"/>
+
+ <menuitem name="GoForward"
+ pixtype="stock" pixname="gtk-go-forward"
+ verb="" accel="*Alt*Right"/>
+
+ <menuitem name="GoUp"
+ pixtype="stock" pixname="gtk-go-up"
+ verb="" accel="*Alt*Up"/>
+
+ <separator/>
+
+ <menuitem name="GoHome"
+ pixtype="stock" pixname="gtk-home"
+ verb="" accel="*Alt*Home"/>
+
+ <menuitem name="GoLocation" _label="_Location..."
+ verb="" accel="*Ctrl*l"/>
+
+ <separator/>
+
+ <menuitem name="History" verb="ToolsHistory"
+ _label="_History" accel="*Control*H"/>
+
+ <menuitem name="BookmarksEdit" verb="" _label="_Bookmarks"
+ accel="*Control*b"/>
+
+ <placeholder name="Favorites" delimit="top"/>
+</submenu>
+
+<submenu name="Tabs" _label="_Tabs">
+ <menuitem name="Previous Tab" verb="TabsPrevious" _label="_Previous Tab"
+ accel="*Control*Page_Up"/>
+ <menuitem name="Next Tab" verb="TabsNext" _label="_Next Tab"
+ accel="*Control*Page_Down"/>
+ <separator/>
+ <menuitem name="Tab Left" verb="TabsMoveLeft" _label="Move Tab _Left"
+ accel="*Shift**Control*Page_Up"/>
+ <menuitem name="Tab Right" verb="TabsMoveRight" _label="Move Tab _Right"
+ accel="*Shift**Control*Page_Down"/>
+ <menuitem name="Move Tab to New Window" verb="TabsDetach" _label="_Detach Tab"
+ accel="*Shift**Control*m"/>
+</submenu>
+
+<submenu name="Help" _label="_Help">
+
+ <menuitem name="HelpContents" verb=""
+ pixtype="stock" pixname="gtk-help"
+ _label="_Contents"/>
+
+ <menuitem name="About" verb="" _label="_About"/>
+
+</submenu>
+
+</menu>
+
+<popups>
+
+ <popup name="EphyEmbedInputPopup">
+ <menuitem name="EditCut"
+ pixtype="stock" pixname="gtk-cut"
+ verb=""/>
+ <menuitem name="EditCopy"
+ pixtype="stock" pixname="gtk-copy"
+ verb=""/>
+ <menuitem name="EditPaste"
+ pixtype="stock" pixname="gtk-paste"
+ verb=""/>
+ </popup>
+
+ <popup name="EphyEmbedDocumentPopup">
+ <placeholder name="NavigationItems">
+ <menuitem name="GoBack"
+ pixtype="stock" pixname="gtk-go-back"
+ verb=""/>
+
+ <menuitem name="GoForward"
+ pixtype="stock" pixname="gtk-go-forward"
+ verb=""/>
+
+ <menuitem name="GoReload"
+ pixtype="stock" pixname="gtk-refresh"
+ verb=""/>
+
+ <separator/>
+ </placeholder>
+
+ <menuitem name="DPSavePageAs"
+ pixtype="stock" pixname="gtk-save"
+ verb=""/>
+
+ <menuitem name="DPSaveBackgroundAs" verb=""/>
+
+ <menuitem name="DPViewSource" _label="Page Source"
+ verb="ViewPageSource"/>
+
+ <menuitem name="DPAddPageBookmark"
+ verb=""/>
+
+ <menuitem name="DPCopyLocation"
+ pixtype="stock" pixname="gtk-copy"
+ verb=""/>
+
+ <placeholder name="FrameItems">
+ <separator/>
+ <menuitem name="DPOpenFrame" verb=""/>
+ <menuitem name="DPOpenFrameInNewWindow" verb=""/>
+ <menuitem name="DPOpenFrameInNewTab" verb=""/>
+ <menuitem name="DPReloadFrame" verb=""/>
+ <menuitem name="DPAddFrameBookmark" verb=""/>
+ </placeholder>
+ </popup>
+
+ <popup name="EphyEmbedElementPopup">
+ <placeholder name="LinkItems">
+ <menuitem name="EPOpenInNewWindow"
+ pixtype="stock" pixname="gtk-open"
+ verb=""/>
+
+ <menuitem name="EPOpenInNewTab" verb=""/>
+
+ <menuitem name="EPCopyLinkLocation"
+ pixtype="stock" pixname="gtk-copy"
+ verb=""/>
+
+ <menuitem name="EPDownloadLink" verb=""/>
+
+ <menuitem name="EPAddBookmark"
+ pixtype="stock" pixname="gtk-add"
+ verb=""/>
+ </placeholder>
+ <placeholder name="EmailLinkItems">
+ <menuitem name="EPCopyEmail"
+ pixtype="stock" pixname="gtk-copy"
+ verb=""/>
+ </placeholder>
+ <placeholder name="BetweenElements1">
+ <separator/>
+ </placeholder>
+
+ <placeholder name="ImageItems">
+ <menuitem name="EPOpenImage"
+ pixtype="stock" pixname="gtk-open"
+ verb=""/>
+
+ <menuitem name="EPOpenImageInNewWindow" verb=""/>
+ <menuitem name="EPOpenImageInNewTab" verb=""/>
+
+ <menuitem name="EPSaveImageAs"
+ pixtype="stock" pixname="gtk-save"
+ verb=""/>
+
+ <menuitem name="EPSetImageAsBackground" verb=""/>
+
+ <menuitem name="EPCopyImageLocation"
+ pixtype="stock" pixname="gtk-copy"
+ verb=""/>
+ </placeholder>
+ </popup>
+</popups>
+
+<dockitem name="Toolbar" behavior="exclusive" config="0">
+</dockitem>
+
+<dockitem name="PrintPreview" behavior="exclusive">
+ <toolitem name="PPVGotoFirst"
+ pixtype="stock" pixname="gtk-goto-first"
+ verb="PPVGotoFirst"/>
+ <toolitem name="PPVGoBack"
+ pixtype="stock" pixname="gtk-go-back"
+ verb="PPVGoBack"/>
+ <toolitem name="PPVGoForward"
+ pixtype="stock" pixname="gtk-go-forward"
+ priority="1"
+ verb="PPVGoForward"/>
+ <toolitem name="PPVGotoLast"
+ pixtype="stock" pixname="gtk-goto-last"
+ verb="PPVGotoLast"/>
+ <toolitem name="Close" _label="Close"
+ pixtype="stock" pixname="gtk-close"
+ priority="1"
+ verb="PPVClose"/>
+</dockitem>
+
+<status resize_grip="0">
+ <item name="main"/>
+ <control name="SecurityIconWrapper"/>
+ <control name="ProgressWrapper"/>
+</status>
+
+</Root>
+
diff --git a/data/ui/nautilus-epiphany-view.xml.in b/data/ui/nautilus-epiphany-view.xml.in
new file mode 100644
index 000000000..d46e5f9f4
--- /dev/null
+++ b/data/ui/nautilus-epiphany-view.xml.in
@@ -0,0 +1,130 @@
+<Root>
+<commands>
+
+ <cmd name="FilePrint" _label="Print"
+ _tip="Print the Current File" pixtype="stock" pixname="gtk-print"
+ accel="*Control*P"/>
+
+ <cmd name="EditCut" _label="Cut" _tip="Cut the Selection"
+ pixtype="stock" pixname="gtk-cut"/>
+
+ <cmd name="EditCopy" _label="Copy"
+ _tip="Copy the Selection" pixtype="stock" pixname="gtk-copy"/>
+
+ <cmd name="EditPaste" _label="Paste"
+ _tip="Paste the Clipboard" pixtype="stock" pixname="gtk-paste"/>
+
+ <cmd name="EditSelectAll" _label="Select All" _tip="Select the Entire Document"
+ accel="*Control*A"/>
+
+ <cmd name="EditFind" _label="Find" _tip="Search for a String"
+ pixtype="stock" pixname="gtk-find" accel="*Control*F"/>
+
+
+ <cmd name="EPOpenInNewWindow" _label="Open in New Window"
+ pixtype="stock" pixname="gtk-new"/>
+
+ <cmd name="EPCopyLinkLocation" _label="Copy Link Location"
+ pixtype="stock" pixname="gtk-copy"/>
+
+ <cmd name="EPDownloadLink" _label="Download Link"/>
+
+ <cmd name="EPOpenImage" _label="Open Image"
+ pixtype="stock" pixname="gtk-open"/>
+
+ <cmd name="EPOpenImageInNewWindow" _label="Open Image in New Window"/>
+
+ <cmd name="EPSaveImageAs" _label="Save Image As..."
+ pixtype="stock" pixname="gtk-save"/>
+
+ <cmd name="EPSetImageAsBackground" _label="Use Image as Background"/>
+
+ <cmd name="EPCopyImageLocation" _label="Copy Image Location"
+ pixtype="stock" pixname="gtk-copy"/>
+
+ <cmd name="DPCopyLocation" _label="Copy Page Location"
+ pixtype="stock" pixname="gtk-copy"/>
+
+ <cmd name="DPOpenFrame" _label="Open Frame"
+ pixtype="stock" pixname="gtk-open"/>
+
+ <cmd name="DPOpenFrameInNewWindow" _label="Open Frame in New Window"/>
+
+ <cmd name="DPAddFrameBookmark" _label="Add Bookmark for Frame"
+ pixtype="stock" pixname="gtk-add"/>
+
+ <cmd name="DPSavePageAs" _label="Save Page As..."
+ pixtype="stock" pixname="gtk-save"/>
+
+ <cmd name="DPSaveBackgroundAs" _label="Save Background As..."/>
+
+ <cmd name="PPVGotoFirst" _label="First"/>
+
+ <cmd name="PPVGotoLast" _label="Last"/>
+
+ <cmd name="PPVGoBack" _label="Previous"/>
+
+ <cmd name="PPVGoForward" _label="Next"/>
+
+ <cmd name="EPCopyEmail" _label="Copy Email Address"/>
+
+</commands>
+
+<menu>
+ <submenu name="File" _label="_File">
+ <menuitem name="FilePrint" verb="" _label="_Print..."/>
+ </submenu>
+ <submenu name="Edit" _label="_Edit">
+ <menuitem name="EditFind" verb="" _label="_Find..."/>
+ </submenu>
+ <submenu name="View">
+ <placeholder name="Encoding"/>
+ </submenu>
+</menu>
+
+<popups>
+
+ <popup name="EphyEmbedInputPopup">
+ <menuitem name="EditCut" verb=""/>
+ <menuitem name="EditCopy" verb=""/>
+ <menuitem name="EditPaste" verb=""/>
+ </popup>
+
+ <popup name="EphyEmbedDocumentPopup">
+ <menuitem name="DPSavePageAs" verb=""/>
+ <menuitem name="DPSaveBackgroundAs" verb=""/>
+ <menuitem name="DPCopyLocation" verb=""/>
+ <submenu name="DPOpenWith" _label="Open With"/>
+ <placeholder name="FrameItems">
+ <separator/>
+ <menuitem name="DPOpenFrame" verb=""/>
+ <menuitem name="DPOpenFrameInNewWindow" verb=""/>
+ </placeholder>
+ </popup>
+
+ <popup name="EphyEmbedElementPopup">
+ <placeholder name="LinkItems">
+ <menuitem name="EPOpenInNewWindow" verb=""/>
+ <menuitem name="EPCopyLinkLocation" verb=""/>
+ <menuitem name="EPDownloadLink" verb=""/>
+ </placeholder>
+ <placeholder name="EmailLinkItems">
+ <menuitem name="EPCopyEmail"
+ pixtype="stock" pixname="gtk-copy"
+ verb=""/>
+ </placeholder>
+ <placeholder name="BetweenElements1">
+ <separator/>
+ </placeholder>
+ <placeholder name="ImageItems">
+ <menuitem name="EPOpenImage" verb=""/>
+ <submenu name="EPOpenImageWith" _label="Open Image with"/>
+ <menuitem name="EPOpenImageInNewWindow" verb=""/>
+ <menuitem name="EPSaveImageAs" verb=""/>
+ <menuitem name="EPSetImageAsBackground" verb=""/>
+ <menuitem name="EPCopyImageLocation" verb=""/>
+ </placeholder>
+ </popup>
+</popups>
+
+</Root>
diff --git a/embed/.cvsignore b/embed/.cvsignore
new file mode 100644
index 000000000..20e4cb0c8
--- /dev/null
+++ b/embed/.cvsignore
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+*.lo
+.deps
+.libs
+*.la
diff --git a/embed/Makefile.am b/embed/Makefile.am
new file mode 100644
index 000000000..a6f43fb46
--- /dev/null
+++ b/embed/Makefile.am
@@ -0,0 +1,57 @@
+SUBDIRS = mozilla
+
+INCLUDES = \
+ -I$(top_srcdir)/embed/mozilla \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/lib/widgets \
+ -I$(MOZILLA_INCLUDE_ROOT)/gtkembedmoz \
+ $(WARN_CFLAGS) \
+ $(EPIPHANY_DEPENDENCY_CFLAGS) \
+ -DSHARE_DIR=\"$(pkgdatadir)\" \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGNOME_DISABLE_DEPRECATED
+
+noinst_LTLIBRARIES = libephyembed.la
+
+libephyembed_la_SOURCES = \
+ ephy-embed-types.h \
+ downloader-view.c \
+ downloader-view.h \
+ ephy-history.c \
+ ephy-history.h \
+ ephy-embed.c \
+ ephy-embed.h \
+ ephy-embed-shell.c \
+ ephy-embed-shell.h \
+ ephy-embed-persist.c \
+ ephy-embed-persist.h \
+ ephy-embed-popup.c \
+ ephy-embed-popup.h \
+ ephy-embed-popup-bw.c \
+ ephy-embed-popup-bw.h \
+ ephy-embed-popup-control.c \
+ ephy-embed-popup-control.h \
+ ephy-embed-event.c \
+ ephy-embed-event.h \
+ ephy-embed-utils.c \
+ ephy-embed-utils.h \
+ ephy-embed-dialog.c \
+ ephy-embed-dialog.h \
+ find-dialog.c \
+ find-dialog.h \
+ print-dialog.c \
+ print-dialog.h \
+ ephy-embed-prefs.h \
+ ephy-favicon-cache.c \
+ ephy-favicon-cache.h \
+ ephy-embed-favicon.c \
+ ephy-embed-favicon.h \
+ ephy-favicon.c \
+ ephy-favicon.h
+
+
+libephyembed_la_LIBADD = \
+ $(top_builddir)/embed/mozilla/libephymozillaembed.la
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
new file mode 100644
index 000000000..97e05a613
--- /dev/null
+++ b/embed/downloader-view.c
@@ -0,0 +1,1100 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "downloader-view.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-gui.h"
+#include "ephy-prefs.h"
+#include "ephy-ellipsizing-label.h"
+#include "ephy-embed-utils.h"
+#include "ephy-file-helpers.h"
+
+#include <gtk/gtktreeview.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtktreeviewcolumn.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <gtk/gtkprogressbar.h>
+#include <libgnomevfs/gnome-vfs-mime-handlers.h>
+
+enum
+{
+ DOWNLOAD_REMOVE,
+ DOWNLOAD_PAUSE,
+ DOWNLOAD_RESUME,
+ LAST_SIGNAL
+};
+
+enum
+{
+ COL_PERCENT,
+ COL_FILENAME,
+ COL_SIZE,
+ COL_REMAINING,
+ COL_PERSIST_OBJECT
+};
+
+struct DownloaderViewPrivate
+{
+ GHashTable *details_hash;
+ GtkTreeModel *model;
+ gboolean show_details;
+
+ /* Widgets */
+ GtkWidget *treeview;
+ GtkWidget *details_file;
+ GtkWidget *details_location;
+ GtkWidget *details_status;
+ GtkWidget *details_elapsed;
+ GtkWidget *details_remaining;
+ GtkWidget *details_progress;
+ GtkWidget *details_button;
+ GtkWidget *keep_open_check;
+ GtkWidget *pause_button;
+ GtkWidget *resume_button;
+ GtkWidget *abort_button;
+ GtkWidget *open_button;
+};
+
+typedef struct
+{
+ glong elapsed;
+ glong remaining;
+ gfloat speed;
+ gint size_total;
+ gint size_done;
+ gfloat progress;
+ gboolean can_pause;
+ gchar *filename;
+ gchar *source;
+ gchar *dest;
+ DownloadStatus status;
+
+ GtkTreeRowReference *ref;
+} DownloadDetails;
+
+typedef struct
+{
+ gboolean can_resume;
+ gboolean can_pause;
+ gboolean can_abort;
+ gboolean can_open;
+ DownloaderViewPrivate *priv;
+} ControlsInfo;
+
+enum
+{
+ PROP_TREEVIEW,
+ PROP_KEEP_OPEN,
+ PROP_DETAILS_FRAME,
+ PROP_DETAILS_SEPARATOR,
+ PROP_DETAILS_TABLE,
+ PROP_DETAILS_STATUS,
+ PROP_DETAILS_ELAPSED,
+ PROP_DETAILS_REMAINING,
+ PROP_DETAILS_PROGRESS,
+ PROP_PAUSE_BUTTON,
+ PROP_RESUME_BUTTON,
+ PROP_ABORT_BUTTON,
+ PROP_OPEN_BUTTON,
+ PROP_DETAILS_BUTTON
+};
+
+static const
+EphyDialogProperty properties [] =
+{
+ { PROP_TREEVIEW, "clist", NULL, PT_NORMAL, NULL },
+ { PROP_KEEP_OPEN, "keep_open_check", CONF_DOWNLOADING_KEEP_OPEN, PT_NORMAL, NULL },
+ { PROP_DETAILS_FRAME, "details_frame", NULL, PT_NORMAL, NULL },
+ { PROP_DETAILS_SEPARATOR, "details_separator", NULL, PT_NORMAL, NULL },
+ { PROP_DETAILS_TABLE, "details_table", NULL, PT_NORMAL, NULL },
+ { PROP_DETAILS_STATUS, "details_status", NULL, PT_NORMAL, NULL },
+ { PROP_DETAILS_ELAPSED, "details_elapsed", NULL, PT_NORMAL, NULL },
+ { PROP_DETAILS_REMAINING, "details_remaining", NULL, PT_NORMAL, NULL },
+ { PROP_DETAILS_PROGRESS, "details_progress", NULL, PT_NORMAL, NULL },
+ { PROP_PAUSE_BUTTON, "pause_button", NULL, PT_NORMAL, NULL },
+ { PROP_RESUME_BUTTON, "resume_button", NULL, PT_NORMAL, NULL },
+ { PROP_ABORT_BUTTON, "abort_button", NULL, PT_NORMAL, NULL },
+ { PROP_OPEN_BUTTON, "open_button", NULL, PT_NORMAL, NULL },
+ { PROP_DETAILS_BUTTON, "details_togglebutton", CONF_DOWNLOADING_SHOW_DETAILS, PT_NORMAL, NULL },
+
+ { -1, NULL, NULL }
+};
+
+static void
+downloader_view_build_ui (DownloaderView *dv);
+static void
+downloader_view_class_init (DownloaderViewClass *klass);
+static void
+downloader_view_finalize (GObject *object);
+static void
+downloader_view_init (DownloaderView *dv);
+
+/* Callbacks */
+void
+download_dialog_resume_cb (GtkButton *button, DownloaderView *dv);
+void
+download_dialog_pause_cb (GtkButton *button, DownloaderView *dv);
+void
+download_dialog_abort_cb (GtkButton *button, DownloaderView *dv);
+static void
+downloader_treeview_selection_changed_cb (GtkTreeSelection *selection,
+ DownloaderView *dv);
+gboolean
+download_dialog_delete_cb (GtkWidget *window, GdkEventAny *event,
+ DownloaderView *dv);
+void
+download_dialog_details_cb (GtkToggleButton *button,
+ DownloaderView *dv);
+void
+download_dialog_open_cb (GtkWidget *button,
+ DownloaderView *dv);
+
+static GObjectClass *parent_class = NULL;
+static guint downloader_view_signals[LAST_SIGNAL] = { 0 };
+
+GType
+downloader_view_get_type (void)
+{
+ static GType downloader_view_type = 0;
+
+ if (downloader_view_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (DownloaderViewClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) downloader_view_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (DownloaderView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) downloader_view_init
+ };
+
+ downloader_view_type = g_type_register_static (EPHY_DIALOG_TYPE,
+ "DownloaderView",
+ &our_info, 0);
+ }
+
+ return downloader_view_type;
+}
+
+static void
+format_time (gchar *buffer, glong time)
+{
+ gint secs, hours, mins;
+
+ secs = (gint)(time + .5);
+ hours = secs / 3600;
+ secs -= hours * 3600;
+ mins = secs / 60;
+ secs -= mins * 60;
+
+ if (hours)
+ {
+ sprintf (buffer, "%u:%02u.%02u", hours, mins, secs);
+ }
+ else
+ {
+ sprintf (buffer, "%02u.%02u", mins, secs);
+ }
+}
+
+static void
+downloader_view_class_init (DownloaderViewClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EphyDialogClass *ephy_dialog_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ ephy_dialog_class = EPHY_DIALOG_CLASS (klass);
+
+ object_class->finalize = downloader_view_finalize;
+
+ /* init signals */
+ downloader_view_signals[DOWNLOAD_REMOVE] =
+ g_signal_new ("download_remove",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (DownloaderViewClass, download_remove),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ downloader_view_signals[DOWNLOAD_PAUSE] =
+ g_signal_new ("download_pause",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (DownloaderViewClass, download_pause),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ downloader_view_signals[DOWNLOAD_RESUME] =
+ g_signal_new ("download_resume",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (DownloaderViewClass, download_resume),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+}
+
+static void
+destroy_details_cb (DownloadDetails *details)
+{
+ g_free (details->filename);
+ g_free (details->source);
+ g_free (details->dest);
+ g_free (details);
+}
+
+static void
+downloader_view_init (DownloaderView *dv)
+{
+ dv->priv = g_new0 (DownloaderViewPrivate, 1);
+ dv->priv->details_hash = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
+ NULL,
+ (GDestroyNotify)destroy_details_cb);
+
+ downloader_view_build_ui (dv);
+}
+
+static void
+downloader_view_finalize (GObject *object)
+{
+ DownloaderView *dv;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_DOWNLOADER_VIEW (object));
+
+ dv = DOWNLOADER_VIEW (object);
+
+ g_return_if_fail (dv->priv != NULL);
+
+ g_hash_table_destroy (dv->priv->details_hash);
+
+ g_free (dv->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+DownloaderView *
+downloader_view_new (void)
+{
+ return DOWNLOADER_VIEW (g_object_new
+ (DOWNLOADER_VIEW_TYPE, NULL));
+}
+
+static void
+controls_info_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ ControlsInfo *info)
+{
+ DownloadDetails *details;
+ GValue val = {0, };
+ gpointer persist_object;
+
+ gtk_tree_model_get_value (model, iter, COL_PERSIST_OBJECT, &val);
+ persist_object = g_value_get_pointer (&val);
+
+ details = g_hash_table_lookup (info->priv->details_hash,
+ persist_object);
+
+ info->can_pause |= details->can_pause;
+ info->can_resume |= (details->status == DOWNLOAD_STATUS_PAUSED);
+ info->can_abort |= (details->status != DOWNLOAD_STATUS_COMPLETED);
+ info->can_open |= (details->status == DOWNLOAD_STATUS_COMPLETED);
+}
+
+static void
+downloader_view_update_controls (DownloaderViewPrivate *priv)
+{
+ GtkTreeSelection *selection;
+ ControlsInfo *info;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->treeview));
+
+ info = g_new0 (ControlsInfo, 1);
+ info->priv = priv;
+
+ /* initial conditions */
+ info->can_pause = info->can_resume = info->can_abort
+ = info->can_open = FALSE;
+
+ if (selection)
+ {
+ gtk_tree_selection_selected_foreach
+ (selection,
+ (GtkTreeSelectionForeachFunc)controls_info_foreach,
+ info);
+ }
+
+ /* setup buttons */
+ gtk_widget_set_sensitive (priv->pause_button, info->can_pause);
+ gtk_widget_set_sensitive (priv->resume_button, info->can_resume);
+ gtk_widget_set_sensitive (priv->abort_button, info->can_abort);
+ gtk_widget_set_sensitive (priv->open_button, info->can_open);
+
+ g_free (info);
+}
+
+static void
+downloader_view_update_details (DownloaderViewPrivate *priv,
+ DownloadDetails *details)
+{
+ gchar buffer[50];
+
+ ephy_ellipsizing_label_set_text
+ (EPHY_ELLIPSIZING_LABEL (priv->details_location),
+ details->source);
+ ephy_ellipsizing_label_set_text
+ (EPHY_ELLIPSIZING_LABEL (priv->details_file),
+ details->filename);
+
+ if (details->size_total >= 10000)
+ {
+ sprintf (buffer, _("%.1f of %.1f MB"),
+ details->size_done / 1024.0,
+ details->size_total / 1024.0);
+ }
+ else if (details->size_total > 0)
+ {
+ sprintf (buffer, _("%d of %d KB"),
+ details->size_done,
+ details->size_total);
+ }
+ else
+ {
+ sprintf (buffer, _("%d KB"),
+ details->size_done);
+ }
+
+ if (details->speed > 0)
+ {
+ sprintf (buffer, "%s at %.1f KB/s", buffer, details->speed);
+ }
+ gtk_label_set_text (GTK_LABEL (priv->details_status),
+ buffer);
+
+ format_time (buffer, details->elapsed/1000000);
+ gtk_label_set_text (GTK_LABEL (priv->details_elapsed),
+ buffer);
+
+ format_time (buffer, details->remaining);
+ gtk_label_set_text (GTK_LABEL (priv->details_remaining),
+ buffer);
+
+ if (details->progress >= 0)
+ {
+ gtk_progress_bar_set_fraction
+ (GTK_PROGRESS_BAR (priv->details_progress),
+ details->progress);
+ }
+ else
+ {
+ gtk_progress_bar_pulse
+ (GTK_PROGRESS_BAR (priv->details_progress));
+ }
+}
+
+static gboolean
+get_selected_row (DownloaderViewPrivate *priv, GtkTreeIter *iter)
+{
+ GList *l;
+ GtkTreePath *node;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->treeview));
+ l = gtk_tree_selection_get_selected_rows (selection, &model);
+
+ if (l == NULL) return FALSE;
+
+ node = l->data;
+ gtk_tree_model_get_iter (model, iter, node);
+
+ g_list_foreach (l, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (l);
+
+ return TRUE;
+}
+
+static void
+downloader_view_set_download_info (DownloaderViewPrivate *priv,
+ DownloadDetails *details,
+ GtkTreeIter *iter)
+{
+ gchar buffer[50];
+ GtkTreePath *path;
+ GtkTreePath *selected_path = NULL;
+ GtkTreeIter selected_iter;
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection
+ (GTK_TREE_VIEW(priv->treeview));
+
+ if (get_selected_row (priv, &selected_iter))
+ {
+ selected_path = gtk_tree_model_get_path
+ (priv->model, &selected_iter);
+ }
+
+ path = gtk_tree_row_reference_get_path (details->ref);
+
+ gtk_list_store_set (GTK_LIST_STORE (priv->model),
+ iter,
+ COL_FILENAME, details->filename,
+ -1);
+
+ /* Progress */
+ if (details->status == DOWNLOAD_STATUS_COMPLETED)
+ details->progress = 1;
+ sprintf (buffer, "%.1f%%",
+ details->progress > 0 ?
+ details->progress * 100.0 :
+ 0);
+ gtk_list_store_set (GTK_LIST_STORE (priv->model),
+ iter,
+ COL_PERCENT, buffer,
+ -1);
+
+ /* Total */
+ if (details->size_total >= 10000)
+ {
+ sprintf (buffer, "%.2f MB", details->size_total / 1024.0);
+ }
+ else if (details->size_total > 0)
+ {
+ sprintf (buffer, "%d KB", details->size_total);
+ }
+ else
+ {
+ sprintf (buffer, _("Unknown"));
+ }
+
+ gtk_list_store_set (GTK_LIST_STORE (priv->model),
+ iter,
+ COL_SIZE, buffer,
+ -1);
+
+ /* Remaining */
+ if (details->remaining >= 0)
+ {
+ format_time (buffer, details->remaining);
+ }
+ else
+ {
+ sprintf (buffer, _("Unknown"));
+ }
+ gtk_list_store_set (GTK_LIST_STORE (priv->model),
+ iter,
+ COL_REMAINING, buffer,
+ -1);
+
+ if (gtk_tree_path_compare (path, selected_path) == 0)
+ {
+ downloader_view_update_details (priv, details);
+ }
+}
+
+static void
+ensure_selected_row (DownloaderView *dv)
+{
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+
+ g_return_if_fail (IS_DOWNLOADER_VIEW(dv));
+
+ selection = gtk_tree_view_get_selection
+ (GTK_TREE_VIEW(dv->priv->treeview));
+ if (get_selected_row (dv->priv, &iter))
+ {
+ /* there is already a selection */
+ return;
+ }
+
+ if (gtk_tree_model_get_iter_first (dv->priv->model, &iter))
+ {
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+}
+
+void
+downloader_view_add_download (DownloaderView *dv,
+ gchar *filename,
+ gchar *source,
+ gchar *dest,
+ gpointer persist_object)
+{
+ GtkTreeIter iter;
+ DownloadDetails *details;
+ GtkTreeSelection *selection;
+
+ details = g_new0 (DownloadDetails, 1);
+ details->filename = g_strdup (filename);
+ details->source = g_strdup (source);
+ details->dest = g_strdup (dest);
+ details->elapsed = -1;
+ details->remaining = -1;
+ details->speed = -1;
+ details->size_total = -1;
+ details->size_done = -1;
+ details->progress = -1;
+ dv->priv->show_details = FALSE;
+
+ g_hash_table_insert (dv->priv->details_hash,
+ persist_object,
+ details);
+
+ gtk_list_store_append (GTK_LIST_STORE (dv->priv->model),
+ &iter);
+
+ details->ref = gtk_tree_row_reference_new
+ (GTK_TREE_MODEL (dv->priv->model),
+ gtk_tree_model_get_path
+ (GTK_TREE_MODEL (dv->priv->model), &iter));
+
+ gtk_list_store_set (GTK_LIST_STORE (dv->priv->model),
+ &iter,
+ COL_PERSIST_OBJECT, persist_object,
+ -1);
+
+ selection = gtk_tree_view_get_selection
+ (GTK_TREE_VIEW(dv->priv->treeview));
+ gtk_tree_selection_unselect_all (selection);
+ gtk_tree_selection_select_iter (selection, &iter);
+
+ downloader_view_set_download_info (dv->priv, details, &iter);
+
+ ephy_dialog_show (EPHY_DIALOG(dv));
+}
+
+void
+downloader_view_remove_download (DownloaderView *dv,
+ gpointer persist_object)
+{
+ DownloadDetails *details;
+ GtkTreeIter iter;
+ GValue keep_open = {0, };
+
+ details = g_hash_table_lookup (dv->priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (dv->priv->model),
+ &iter,
+ gtk_tree_row_reference_get_path (details->ref));
+
+ gtk_list_store_remove (GTK_LIST_STORE (dv->priv->model), &iter);
+
+ g_hash_table_remove (dv->priv->details_hash,
+ persist_object);
+
+ ephy_dialog_get_value (EPHY_DIALOG(dv), PROP_KEEP_OPEN, &keep_open);
+
+ if (!g_value_get_boolean (&keep_open) &&
+ g_hash_table_size (dv->priv->details_hash) == 0)
+ {
+ g_object_unref (dv);
+ }
+ else
+ {
+ ensure_selected_row (dv);
+ }
+}
+
+void
+downloader_view_set_download_progress (DownloaderView *dv,
+ glong elapsed,
+ glong remaining,
+ gfloat speed,
+ gint size_total,
+ gint size_done,
+ gfloat progress,
+ gboolean can_pause,
+ gpointer persist_object)
+{
+ DownloadDetails *details;
+ GtkTreeIter iter;
+
+ details = g_hash_table_lookup (dv->priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ details->elapsed = elapsed;
+ details->remaining = remaining;
+ details->speed = speed;
+ details->size_total = size_total;
+ details->size_done = size_done;
+ details->can_pause = can_pause;
+ details->progress = progress;
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (dv->priv->model),
+ &iter,
+ gtk_tree_row_reference_get_path (details->ref));
+
+ downloader_view_set_download_info (dv->priv, details, &iter);
+}
+
+void
+downloader_view_set_download_status (DownloaderView *dv,
+ DownloadStatus status,
+ gpointer persist_object)
+{
+ DownloadDetails *details;
+ GtkTreeIter iter;
+ GValue keep_open = {0, };
+
+ details = g_hash_table_lookup (dv->priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ details->status = status;
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (dv->priv->model),
+ &iter,
+ gtk_tree_row_reference_get_path (details->ref));
+
+ downloader_view_set_download_info (dv->priv, details, &iter);
+ downloader_view_update_controls (dv->priv);
+
+ ephy_dialog_get_value (EPHY_DIALOG(dv), PROP_KEEP_OPEN, &keep_open);
+
+ if (status == DOWNLOAD_STATUS_COMPLETED &&
+ !g_value_get_boolean (&keep_open))
+ {
+ downloader_view_remove_download (dv, persist_object);
+ }
+}
+
+static void
+downloader_view_build_ui (DownloaderView *dv)
+{
+ DownloaderViewPrivate *priv = dv->priv;
+ GtkListStore *liststore;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ GtkTreeSelection *selection;
+ GtkWidget *details_table;
+ EphyDialog *d = EPHY_DIALOG (dv);
+
+ ephy_dialog_construct (d,
+ properties,
+ "epiphany.glade",
+ "download_manager_dialog");
+
+ /* lookup needed widgets */
+ priv->treeview = ephy_dialog_get_control (d, PROP_TREEVIEW);
+ priv->details_status = ephy_dialog_get_control (d, PROP_DETAILS_STATUS);
+ priv->details_elapsed = ephy_dialog_get_control (d, PROP_DETAILS_ELAPSED);
+ priv->details_remaining = ephy_dialog_get_control (d, PROP_DETAILS_REMAINING);
+ priv->details_progress = ephy_dialog_get_control (d, PROP_DETAILS_PROGRESS);
+ priv->keep_open_check = ephy_dialog_get_control (d, PROP_KEEP_OPEN);
+ priv->details_button = ephy_dialog_get_control (d, PROP_DETAILS_BUTTON);
+ priv->pause_button = ephy_dialog_get_control (d, PROP_PAUSE_BUTTON);
+ priv->resume_button = ephy_dialog_get_control (d, PROP_RESUME_BUTTON);
+ priv->abort_button = ephy_dialog_get_control (d, PROP_ABORT_BUTTON);
+ priv->open_button = ephy_dialog_get_control (d, PROP_OPEN_BUTTON);
+ details_table = ephy_dialog_get_control (d, PROP_DETAILS_TABLE);
+
+ /* create file and location details labels */
+ priv->details_location = ephy_ellipsizing_label_new ("");
+ priv->details_file = ephy_ellipsizing_label_new ("");
+ gtk_table_attach_defaults (GTK_TABLE(details_table), priv->details_location,
+ 1, 2, 0, 1);
+ gtk_table_attach_defaults (GTK_TABLE(details_table), priv->details_file,
+ 1, 2, 1, 2);
+ gtk_misc_set_alignment (GTK_MISC(priv->details_location), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC(priv->details_file), 0, 0);
+ gtk_label_set_selectable (GTK_LABEL(priv->details_location), TRUE);
+ gtk_label_set_selectable (GTK_LABEL(priv->details_file), TRUE);
+ gtk_widget_show (priv->details_location);
+ gtk_widget_show (priv->details_file);
+
+ liststore = gtk_list_store_new (5,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_POINTER);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW(priv->treeview),
+ GTK_TREE_MODEL (liststore));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(priv->treeview),
+ TRUE);
+
+ renderer = gtk_cell_renderer_text_new ();
+
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview),
+ 0, _("%"),
+ renderer,
+ "text", 0,
+ NULL);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), 0);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_column_set_reorderable (column, TRUE);
+ gtk_tree_view_column_set_sort_column_id (column, COL_PERCENT);
+
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview),
+ COL_FILENAME, _("Filename"),
+ renderer,
+ "text", COL_FILENAME,
+ NULL);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview),
+ COL_FILENAME);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_column_set_reorderable (column, TRUE);
+ gtk_tree_view_column_set_sort_column_id (column, COL_FILENAME);
+
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview),
+ COL_SIZE, _("Size"),
+ renderer,
+ "text", COL_SIZE,
+ NULL);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview),
+ COL_SIZE);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_column_set_reorderable (column, TRUE);
+ gtk_tree_view_column_set_sort_column_id (column, COL_SIZE);
+
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview),
+ COL_REMAINING, _("Remaining"),
+ renderer,
+ "text", COL_REMAINING,
+ NULL);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview),
+ COL_REMAINING);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_column_set_reorderable (column, TRUE);
+ gtk_tree_view_column_set_sort_column_id (column, COL_REMAINING);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->treeview));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (downloader_treeview_selection_changed_cb), dv);
+
+ priv->model = GTK_TREE_MODEL (liststore);
+}
+
+static void
+resume_selection_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+ DownloaderView *dv)
+{
+ DownloadDetails *details;
+ GValue val = {0, };
+ gpointer *persist_object;
+
+ gtk_tree_model_get_value (model, iter, COL_PERSIST_OBJECT, &val);
+ persist_object = g_value_get_pointer (&val);
+
+ details = g_hash_table_lookup (dv->priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ if (details->status == DOWNLOAD_STATUS_COMPLETED) return;
+
+ downloader_view_set_download_status (dv, DOWNLOAD_STATUS_RESUMING, persist_object);
+
+ g_signal_emit (G_OBJECT (dv), downloader_view_signals[DOWNLOAD_RESUME], 0);
+}
+
+void
+download_dialog_resume_cb (GtkButton *button, DownloaderView *dv)
+{
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview));
+
+ gtk_tree_selection_selected_foreach
+ (selection,
+ (GtkTreeSelectionForeachFunc)resume_selection_foreach,
+ (gpointer)dv);
+}
+
+static void
+pause_selection_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+ DownloaderView *dv)
+{
+ DownloadDetails *details;
+ GValue val = {0, };
+ gpointer *persist_object;
+
+ gtk_tree_model_get_value (model, iter, COL_PERSIST_OBJECT, &val);
+ persist_object = g_value_get_pointer (&val);
+
+ details = g_hash_table_lookup (dv->priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ if (details->status == DOWNLOAD_STATUS_COMPLETED) return;
+
+ downloader_view_set_download_status (dv, DOWNLOAD_STATUS_PAUSED, persist_object);
+
+ g_signal_emit (G_OBJECT (dv), downloader_view_signals[DOWNLOAD_PAUSE], 0);
+}
+
+void
+download_dialog_pause_cb (GtkButton *button, DownloaderView *dv)
+{
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview));
+
+ gtk_tree_selection_selected_foreach
+ (selection,
+ (GtkTreeSelectionForeachFunc)pause_selection_foreach,
+ (gpointer)dv);
+}
+
+void
+download_dialog_abort_cb (GtkButton *button, DownloaderView *dv)
+{
+ GList *l, *r = NULL;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview));
+ l = gtk_tree_selection_get_selected_rows (selection, &model);
+ for (;l != NULL; l = l->next)
+ {
+ r = g_list_append (r, gtk_tree_row_reference_new
+ (model, (GtkTreePath *)l->data));
+ }
+
+ for (; r != NULL; r = g_list_next (r))
+ {
+ GtkTreeRowReference *node = r->data;
+ GValue val = {0, };
+ gpointer *persist_object;
+ GtkTreeIter iter;
+ DownloadDetails *details;
+
+ gtk_tree_model_get_iter (model, &iter,
+ gtk_tree_row_reference_get_path (node));
+
+ gtk_tree_model_get_value (model, &iter,
+ COL_PERSIST_OBJECT, &val);
+ persist_object = g_value_get_pointer (&val);
+
+ details = g_hash_table_lookup (dv->priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ g_signal_emit (G_OBJECT (dv), downloader_view_signals[DOWNLOAD_REMOVE], 0);
+
+ downloader_view_remove_download (dv, persist_object);
+
+ gtk_tree_row_reference_free (node);
+ }
+
+ l = g_list_first (l);
+ g_list_foreach (l, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (l);
+ g_list_free (r);
+}
+
+static void
+downloader_treeview_selection_changed_cb (GtkTreeSelection *selection,
+ DownloaderView *dv)
+{
+ GtkTreeIter iter;
+ GValue val = {0, };
+ gpointer *persist_object;
+ DownloadDetails *details = NULL;
+ GtkWidget *details_frame;
+ DownloaderViewPrivate *priv= dv->priv;
+
+ details_frame = ephy_dialog_get_control (EPHY_DIALOG(dv),
+ PROP_DETAILS_FRAME);
+
+ if (get_selected_row (priv, &iter))
+ {
+ gtk_tree_model_get_value (priv->model, &iter, COL_PERSIST_OBJECT, &val);
+ persist_object = g_value_get_pointer (&val);
+
+ details = g_hash_table_lookup (priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ gtk_widget_set_sensitive (details_frame, TRUE);
+
+ downloader_view_update_details (priv, details);
+ downloader_view_update_controls (priv);
+ }
+ else
+ {
+ gtk_label_set_text (GTK_LABEL (priv->details_location), "");
+ gtk_label_set_text (GTK_LABEL (priv->details_file), "");
+ gtk_label_set_text (GTK_LABEL (priv->details_status), "");
+ gtk_label_set_text (GTK_LABEL (priv->details_elapsed), "");
+ gtk_label_set_text (GTK_LABEL (priv->details_remaining), "");
+ gtk_progress_bar_set_fraction
+ (GTK_PROGRESS_BAR (priv->details_progress),
+ 0);
+
+ gtk_widget_set_sensitive (details_frame, FALSE);
+ }
+}
+
+static void
+alive_download_foreach (gpointer persist_object,
+ DownloadDetails *details,
+ gboolean *alive)
+{
+ if (details->status != DOWNLOAD_STATUS_COMPLETED)
+ {
+ *alive = TRUE;
+ }
+}
+
+static gboolean
+delete_pending_foreach (gpointer persist_object,
+ DownloadDetails *details,
+ DownloaderView *dv)
+{
+ g_signal_emit (G_OBJECT (dv), downloader_view_signals[DOWNLOAD_REMOVE],
+ 0, persist_object);
+
+ return TRUE;
+}
+
+gboolean
+download_dialog_delete_cb (GtkWidget *window, GdkEventAny *event,
+ DownloaderView *dv)
+{
+ GtkWidget *dialog;
+ gboolean choice;
+ gboolean alive_download = FALSE;
+
+ g_hash_table_foreach (dv->priv->details_hash,
+ (GHFunc)alive_download_foreach,
+ &alive_download);
+
+ if (!alive_download) return FALSE;
+
+ /* build question dialog */
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW(window),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_YES_NO,
+ _("Cancel all pending downloads?"));
+
+ /* run it */
+ choice = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ /* do the appropriate thing */
+ if (choice == GTK_RESPONSE_YES)
+ {
+ g_hash_table_foreach_remove (dv->priv->details_hash,
+ (GHRFunc)delete_pending_foreach,
+ dv);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void
+download_dialog_details_cb (GtkToggleButton *button,
+ DownloaderView *dv)
+{
+ GtkWidget *details_frame;
+ GtkWidget *details_separator;
+
+ details_frame = ephy_dialog_get_control (EPHY_DIALOG(dv),
+ PROP_DETAILS_FRAME);
+ details_separator = ephy_dialog_get_control (EPHY_DIALOG(dv),
+ PROP_DETAILS_SEPARATOR);
+
+ if (gtk_toggle_button_get_active (button))
+ {
+ gtk_widget_show (GTK_WIDGET (details_frame));
+ gtk_widget_show (GTK_WIDGET (details_separator));
+ dv->priv->show_details = TRUE;
+ }
+ else
+ {
+ gtk_widget_hide (GTK_WIDGET (details_frame));
+ gtk_widget_hide (GTK_WIDGET (details_separator));
+ dv->priv->show_details = FALSE;
+ }
+
+}
+
+static void
+open_selection_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+ DownloaderView *dv)
+{
+ DownloadDetails *details;
+ GValue val = {0, };
+ gpointer *persist_object;
+ GnomeVFSMimeApplication *app;
+ char *mime;
+
+ gtk_tree_model_get_value (model, iter, COL_PERSIST_OBJECT, &val);
+ persist_object = g_value_get_pointer (&val);
+
+ details = g_hash_table_lookup (dv->priv->details_hash,
+ persist_object);
+ g_return_if_fail (details);
+
+ if (details->status != DOWNLOAD_STATUS_COMPLETED) return;
+
+ mime = gnome_vfs_get_mime_type (details->dest);
+ g_return_if_fail (mime != NULL);
+
+ app = gnome_vfs_mime_get_default_application (mime);
+ if (app)
+ {
+ ephy_file_launch_application (app->command,
+ details->dest,
+ app->requires_terminal);
+ }
+ else
+ {
+ GtkWidget *parent;
+ parent = gtk_widget_get_toplevel (dv->priv->open_button);
+ ephy_embed_utils_nohandler_dialog_run (parent);
+ }
+
+ g_free(mime);
+}
+
+void
+download_dialog_open_cb (GtkWidget *button,
+ DownloaderView *dv)
+{
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview));
+
+ gtk_tree_selection_selected_foreach
+ (selection,
+ (GtkTreeSelectionForeachFunc)open_selection_foreach,
+ (gpointer)dv);
+}
diff --git a/embed/downloader-view.h b/embed/downloader-view.h
new file mode 100644
index 000000000..a01d5f30d
--- /dev/null
+++ b/embed/downloader-view.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef DOWNLOADER_VIEW_H
+#define DOWNLOADER_VIEW_H
+
+#include "ephy-dialog.h"
+
+#include <glib-object.h>
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct DownloaderView DownloaderView;
+typedef struct DownloaderViewClass DownloaderViewClass;
+
+#define DOWNLOADER_VIEW_TYPE (downloader_view_get_type ())
+#define DOWNLOADER_VIEW(obj) (GTK_CHECK_CAST ((obj), DOWNLOADER_VIEW_TYPE, DownloaderView))
+#define DOWNLOADER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), DOWNLOADER_VIEW, DownloaderViewClass))
+#define IS_DOWNLOADER_VIEW(obj) (GTK_CHECK_TYPE ((obj), DOWNLOADER_VIEW_TYPE))
+#define IS_DOWNLOADER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), DOWNLOADER_VIEW))
+
+typedef struct DownloaderViewPrivate DownloaderViewPrivate;
+
+#define CONF_DOWNLOADING_KEEP_OPEN "/apps/epiphany/downloader/keep_open"
+
+typedef enum
+{
+ DOWNLOAD_STATUS_DOWNLOADING,
+ DOWNLOAD_STATUS_PAUSED,
+ DOWNLOAD_STATUS_RESUMING,
+ DOWNLOAD_STATUS_COMPLETED
+} DownloadStatus;
+
+struct DownloaderView
+{
+ EphyDialog parent;
+ DownloaderViewPrivate *priv;
+};
+
+struct DownloaderViewClass
+{
+ EphyDialogClass parent_class;
+
+ void (*download_remove) (DownloaderView *dv);
+
+ void (*download_pause) (DownloaderView *dv);
+
+ void (*download_resume) (DownloaderView *dv);
+};
+
+GType downloader_view_get_type (void);
+
+DownloaderView *downloader_view_new (void);
+
+void downloader_view_add_download (DownloaderView *dv,
+ gchar *filename,
+ gchar *source,
+ gchar *dest,
+ gpointer persist_object);
+
+void downloader_view_remove_download (DownloaderView *dv,
+ gpointer persist_object);
+
+void downloader_view_set_download_status (DownloaderView *dv,
+ DownloadStatus status,
+ gpointer persist_object);
+
+void downloader_view_set_download_progress (DownloaderView *dv,
+ glong elapsed,
+ glong remaining,
+ gfloat speed,
+ gint size_total,
+ gint size_done,
+ gfloat progress,
+ gboolean can_pause,
+ gpointer persist_object);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/embed/ephy-embed-dialog.c b/embed/ephy-embed-dialog.c
new file mode 100644
index 000000000..cc019253a
--- /dev/null
+++ b/embed/ephy-embed-dialog.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-embed-dialog.h"
+#include "ephy-embed-shell.h"
+
+static void
+ephy_embed_dialog_class_init (EphyEmbedDialogClass *klass);
+static void
+ephy_embed_dialog_init (EphyEmbedDialog *window);
+static void
+ephy_embed_dialog_finalize (GObject *object);
+static void
+ephy_embed_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void
+ephy_embed_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+enum
+{
+ PROP_0,
+ PROP_EPHY_EMBED
+};
+
+struct EphyEmbedDialogPrivate
+{
+ EphyEmbed *embed;
+};
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_embed_dialog_get_type (void)
+{
+ static GType ephy_embed_dialog_type = 0;
+
+ if (ephy_embed_dialog_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedDialogClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_embed_dialog_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (EphyEmbedDialog),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_embed_dialog_init
+ };
+
+ ephy_embed_dialog_type = g_type_register_static (EPHY_DIALOG_TYPE,
+ "EphyEmbedDialog",
+ &our_info, 0);
+ }
+
+ return ephy_embed_dialog_type;
+}
+
+static void
+ephy_embed_dialog_class_init (EphyEmbedDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_embed_dialog_finalize;
+ object_class->set_property = ephy_embed_dialog_set_property;
+ object_class->get_property = ephy_embed_dialog_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_EPHY_EMBED,
+ g_param_spec_object ("EphyEmbed",
+ "EphyEmbed",
+ "Ephy Embed",
+ G_TYPE_OBJECT,
+ G_PARAM_READWRITE));
+}
+
+static void
+ephy_embed_dialog_init (EphyEmbedDialog *dialog)
+{
+ dialog->priv = g_new0 (EphyEmbedDialogPrivate, 1);
+
+ dialog->priv->embed = NULL;
+}
+
+static void
+ephy_embed_dialog_finalize (GObject *object)
+{
+ EphyEmbedDialog *dialog;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_EMBED_DIALOG (object));
+
+ dialog = EPHY_EMBED_DIALOG (object);
+
+ g_return_if_fail (dialog->priv != NULL);
+
+ g_free (dialog->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+ephy_embed_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedDialog *d = EPHY_EMBED_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_EPHY_EMBED:
+ ephy_embed_dialog_set_embed (d, g_value_get_object (value));
+ break;
+ }
+}
+
+static void
+ephy_embed_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedDialog *d = EPHY_EMBED_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_EPHY_EMBED:
+ g_value_set_object (value, d->priv->embed);
+ break;
+ }
+}
+
+EphyEmbedDialog *
+ephy_embed_dialog_new (EphyEmbed *embed)
+{
+ return EPHY_EMBED_DIALOG (g_object_new (EPHY_EMBED_DIALOG_TYPE,
+ "EphyEmbed", embed,
+ NULL));
+}
+
+EphyEmbedDialog *
+ephy_embed_dialog_new_with_parent (GtkWidget *parent_window,
+ EphyEmbed *embed)
+{
+ return EPHY_EMBED_DIALOG (g_object_new
+ (EPHY_EMBED_DIALOG_TYPE,
+ "ParentWindow", parent_window,
+ "EphyEmbed", embed,
+ NULL));
+}
+
+void
+ephy_embed_dialog_set_embed (EphyEmbedDialog *dialog,
+ EphyEmbed *embed)
+{
+ dialog->priv->embed = embed;
+}
+
+EphyEmbed *
+ephy_embed_dialog_get_embed (EphyEmbedDialog *dialog)
+{
+ if (dialog->priv->embed == NULL)
+ {
+ EphyEmbed *embed;
+ embed = ephy_embed_shell_get_active_embed (embed_shell);
+ ephy_embed_dialog_set_embed (dialog, embed);
+ }
+
+ return dialog->priv->embed;
+}
diff --git a/embed/ephy-embed-dialog.h b/embed/ephy-embed-dialog.h
new file mode 100644
index 000000000..e8b7d3a3e
--- /dev/null
+++ b/embed/ephy-embed-dialog.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_DIALOG_H
+#define EPHY_EMBED_DIALOG_H
+
+#include "ephy-embed.h"
+#include "ephy-dialog.h"
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedDialogClass EphyEmbedDialogClass;
+
+#define EPHY_EMBED_DIALOG_TYPE (ephy_embed_dialog_get_type ())
+#define EPHY_EMBED_DIALOG(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_DIALOG_TYPE, EphyEmbedDialog))
+#define EPHY_EMBED_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_DIALOG_TYPE, EphyEmbedDialogClass))
+#define IS_EPHY_EMBED_DIALOG(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_DIALOG_TYPE))
+#define IS_EPHY_EMBED_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_DIALOG))
+#define EPHY_EMBED_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_DIALOG_TYPE, EphyEmbedDialogClass))
+
+typedef struct EphyEmbedDialog EphyEmbedDialog;
+typedef struct EphyEmbedDialogPrivate EphyEmbedDialogPrivate;
+
+struct EphyEmbedDialog
+{
+ EphyDialog parent;
+ EphyEmbedDialogPrivate *priv;
+};
+
+struct EphyEmbedDialogClass
+{
+ EphyDialogClass parent_class;
+};
+
+GType ephy_embed_dialog_get_type (void);
+
+EphyEmbedDialog *ephy_embed_dialog_new (EphyEmbed *embed);
+
+EphyEmbedDialog *ephy_embed_dialog_new_with_parent (GtkWidget *parent_window,
+ EphyEmbed *embed);
+
+void ephy_embed_dialog_set_embed (EphyEmbedDialog *dialog,
+ EphyEmbed *embed);
+
+EphyEmbed * ephy_embed_dialog_get_embed (EphyEmbedDialog *dialog);
+
+G_END_DECLS
+
+#endif
+
diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c
new file mode 100644
index 000000000..fdbd53eab
--- /dev/null
+++ b/embed/ephy-embed-event.c
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-embed-event.h"
+
+#include <bonobo/bonobo-i18n.h>
+#include <glib/ghash.h>
+#include <gtk/gtktypeutils.h>
+
+struct EphyEmbedEventPrivate
+{
+ GHashTable *props;
+};
+
+static void
+ephy_embed_event_class_init (EphyEmbedEventClass *klass);
+static void
+ephy_embed_event_init (EphyEmbedEvent *ges);
+static void
+ephy_embed_event_finalize (GObject *object);
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_embed_event_get_type (void)
+{
+ static GType ephy_embed_event_type = 0;
+
+ if (ephy_embed_event_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedEventClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_embed_event_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EphyEmbedEvent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_embed_event_init
+ };
+
+ ephy_embed_event_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyEmbedEvent",
+ &our_info, 0);
+ }
+
+ return ephy_embed_event_type;
+}
+
+static void
+ephy_embed_event_class_init (EphyEmbedEventClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_embed_event_finalize;
+}
+
+static void
+ephy_embed_event_init (EphyEmbedEvent *event)
+{
+ event->priv = g_new0 (EphyEmbedEventPrivate, 1);
+
+ event->priv->props = g_hash_table_new (g_str_hash, g_str_equal);
+}
+
+static void
+ephy_embed_event_finalize (GObject *object)
+{
+ EphyEmbedEvent *event;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_EMBED_EVENT (object));
+
+ event = EPHY_EMBED_EVENT (object);
+
+ g_return_if_fail (event->priv != NULL);
+
+ g_hash_table_foreach_remove (event->priv->props,
+ (GHRFunc)g_free,
+ NULL);
+ g_hash_table_destroy (event->priv->props);
+
+ g_free (event->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+EphyEmbedEvent *
+ephy_embed_event_new (void)
+{
+ EphyEmbedEvent *event;
+
+ event = EPHY_EMBED_EVENT (g_object_new (EPHY_EMBED_EVENT_TYPE, NULL));
+
+ g_return_val_if_fail (event->priv != NULL, NULL);
+
+ return event;
+}
+
+guint
+ephy_embed_event_get_modifier (EphyEmbedEvent *event)
+{
+ return event->modifier;
+}
+
+gresult
+ephy_embed_event_get_mouse_button (EphyEmbedEvent *event,
+ guint *mouse_button)
+{
+ *mouse_button = event->mouse_button;
+ return G_OK;
+}
+
+gresult
+ephy_embed_event_get_mouse_coords (EphyEmbedEvent *event,
+ guint *x, guint *y)
+{
+ *x = event->mouse_x;
+ *y = event->mouse_y;
+ return G_OK;
+}
+
+gresult
+ephy_embed_event_get_context (EphyEmbedEvent *event,
+ EmbedEventContext *context)
+{
+ *context = event->context;
+ return G_OK;
+}
+
+void
+ephy_embed_event_set_property (EphyEmbedEvent *event,
+ const char *name,
+ GValue *value)
+{
+ g_hash_table_insert (event->priv->props,
+ g_strdup (name),
+ value);
+}
+
+void
+ephy_embed_event_get_property (EphyEmbedEvent *event,
+ const char *name,
+ GValue **value)
+{
+ *value = g_hash_table_lookup (event->priv->props, name);
+}
+
+gboolean
+ephy_embed_event_has_property (EphyEmbedEvent *event,
+ const char *name)
+{
+ gpointer tmp;
+
+ tmp = g_hash_table_lookup (event->priv->props,
+ name);
+
+ return tmp != NULL;
+}
diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h
new file mode 100644
index 000000000..1256dcffc
--- /dev/null
+++ b/embed/ephy-embed-event.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_EVENT_H
+#define EPHY_EMBED_EVENT_H
+
+#include "ephy-embed-types.h"
+
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedEventClass EphyEmbedEventClass;
+
+#define EPHY_EMBED_EVENT_TYPE (ephy_embed_event_get_type ())
+#define EPHY_EMBED_EVENT(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_EVENT_TYPE, EphyEmbedEvent))
+#define EPHY_EMBED_EVENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_PERSIST_SHELL, EphyEmbedEventClass))
+#define IS_EPHY_EMBED_EVENT(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_EVENT_TYPE))
+#define IS_EPHY_EMBED_EVENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_EVENT))
+#define EPHY_EMBED_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_SHELL_TYPE, EphyEmbedEventClass))
+
+typedef struct EphyEmbedEvent EphyEmbedEvent;
+typedef struct EphyEmbedEventPrivate EphyEmbedEventPrivate;
+
+typedef enum
+{
+ EMBED_CONTEXT_NONE = 0,
+ EMBED_CONTEXT_DEFAULT = 1 << 1,
+ EMBED_CONTEXT_LINK = 1 << 2,
+ EMBED_CONTEXT_IMAGE = 1 << 3,
+ EMBED_CONTEXT_DOCUMENT = 1 << 4,
+ EMBED_CONTEXT_INPUT = 1 << 5,
+ EMBED_CONTEXT_XUL = 1 << 7,
+ EMBED_CONTEXT_EMAIL_LINK = 1 << 8
+} EmbedEventContext;
+
+struct EphyEmbedEvent
+{
+ GObject parent;
+ EphyEmbedEventPrivate *priv;
+
+ /* Public to the embed implementations */
+ guint modifier;
+ guint mouse_button;
+ guint context;
+ guint timestamp;
+ guint mouse_x, mouse_y;
+};
+
+struct EphyEmbedEventClass
+{
+ GObjectClass parent_class;
+};
+
+GType ephy_embed_event_get_type (void);
+
+EphyEmbedEvent *ephy_embed_event_new (void);
+
+guint ephy_embed_event_get_modifier (EphyEmbedEvent *event);
+
+gresult ephy_embed_event_get_mouse_button (EphyEmbedEvent *event,
+ guint *mouse_button);
+
+gresult ephy_embed_event_get_mouse_coords (EphyEmbedEvent *event,
+ guint *x, guint *y);
+
+gresult ephy_embed_event_get_context (EphyEmbedEvent *event,
+ EmbedEventContext *context);
+
+void ephy_embed_event_set_property (EphyEmbedEvent *event,
+ const char *name,
+ GValue *value);
+
+void ephy_embed_event_get_property (EphyEmbedEvent *event,
+ const char *name,
+ GValue **value);
+
+gboolean ephy_embed_event_has_property (EphyEmbedEvent *event,
+ const char *name);
+
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed-favicon.c b/embed/ephy-embed-favicon.c
new file mode 100644
index 000000000..d88eb91cf
--- /dev/null
+++ b/embed/ephy-embed-favicon.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+
+#include "ephy-embed-favicon.h"
+#include "ephy-embed-shell.h"
+
+static void ephy_embed_favicon_class_init (EphyEmbedFaviconClass *klass);
+static void ephy_embed_favicon_init (EphyEmbedFavicon *ma);
+static void ephy_embed_favicon_finalize (GObject *object);
+static void ephy_embed_favicon_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void ephy_embed_favicon_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+struct EphyEmbedFaviconPrivate
+{
+ EphyEmbed *embed;
+};
+
+enum
+{
+ PROP_0,
+ PROP_EMBED
+};
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_embed_favicon_get_type (void)
+{
+ static GType ephy_embed_favicon_type = 0;
+
+ if (ephy_embed_favicon_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedFaviconClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) ephy_embed_favicon_class_init,
+ NULL,
+ NULL,
+ sizeof (EphyEmbedFavicon),
+ 0,
+ (GInstanceInitFunc) ephy_embed_favicon_init
+ };
+
+ ephy_embed_favicon_type = g_type_register_static (EPHY_TYPE_FAVICON,
+ "EphyEmbedFavicon",
+ &our_info, 0);
+ }
+
+ return ephy_embed_favicon_type;
+}
+
+static void
+ephy_embed_favicon_class_init (EphyEmbedFaviconClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_embed_favicon_finalize;
+
+ object_class->set_property = ephy_embed_favicon_set_property;
+ object_class->get_property = ephy_embed_favicon_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_EMBED,
+ g_param_spec_object ("embed",
+ "Associated embed",
+ "Associated embed",
+ G_TYPE_OBJECT,
+ G_PARAM_READWRITE));
+}
+
+static void
+ephy_embed_favicon_init (EphyEmbedFavicon *ma)
+{
+ ma->priv = g_new0 (EphyEmbedFaviconPrivate, 1);
+}
+
+static void
+ephy_embed_favicon_finalize (GObject *object)
+{
+ EphyEmbedFavicon *ma;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (EPHY_IS_EMBED_FAVICON (object));
+
+ ma = EPHY_EMBED_FAVICON (object);
+
+ g_return_if_fail (ma->priv != NULL);
+
+ g_free (ma->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+location_changed_cb (EphyEmbed *embed,
+ EphyEmbedFavicon *favicon)
+{
+ char *location;
+
+ ephy_embed_get_location (embed, TRUE, FALSE, &location);
+ ephy_favicon_set_url (EPHY_FAVICON (favicon), location);
+
+ g_free (location);
+}
+
+static void
+favicon_cb (EphyEmbed *embed,
+ const char *favicon_url,
+ EphyEmbedFavicon *favicon)
+{
+ char *url = NULL;
+ EphyFaviconCache *cache;
+
+ if (favicon->priv->embed == NULL)
+ return;
+
+ ephy_embed_get_location (favicon->priv->embed, TRUE, TRUE, &url);
+
+ g_object_get (G_OBJECT (favicon),
+ "cache", &cache,
+ NULL);
+
+ ephy_favicon_cache_insert_from_url (cache,
+ url,
+ favicon_url);
+
+ g_object_unref (cache);
+
+ g_free (url);
+}
+
+static void
+ephy_embed_favicon_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedFavicon *favicon = EPHY_EMBED_FAVICON (object);
+
+ switch (prop_id)
+ {
+ case PROP_EMBED:
+ favicon->priv->embed = g_value_get_object (value);
+
+ if (favicon->priv->embed != NULL)
+ {
+ g_signal_connect_object (G_OBJECT (favicon->priv->embed),
+ "ge_favicon",
+ G_CALLBACK (favicon_cb),
+ favicon,
+ 0);
+ g_signal_connect_object (G_OBJECT (favicon->priv->embed),
+ "ge_location",
+ G_CALLBACK (location_changed_cb),
+ favicon,
+ 0);
+ }
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+ephy_embed_favicon_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedFavicon *favicon = EPHY_EMBED_FAVICON (object);
+
+ switch (prop_id)
+ {
+ case PROP_EMBED:
+ g_value_set_object (value, favicon->priv->embed);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+GtkWidget *
+ephy_embed_favicon_new (EphyEmbed *embed)
+{
+ EphyEmbedFavicon *favicon;
+ EphyFaviconCache *cache = ephy_embed_shell_get_favicon_cache (embed_shell);
+
+ g_return_val_if_fail (EPHY_IS_FAVICON_CACHE (cache), NULL);
+
+ favicon = EPHY_EMBED_FAVICON (g_object_new (EPHY_TYPE_EMBED_FAVICON,
+ "cache", cache,
+ "embed", embed,
+ NULL));
+
+ g_return_val_if_fail (favicon->priv != NULL, NULL);
+
+ return GTK_WIDGET (favicon);
+}
+
+void
+ephy_embed_favicon_set_embed (EphyEmbedFavicon *favicon,
+ EphyEmbed *embed)
+{
+ g_return_if_fail (EPHY_IS_EMBED_FAVICON (favicon));
+
+ g_object_set (G_OBJECT (favicon),
+ "embed", embed,
+ NULL);
+}
+
+EphyEmbed *
+ephy_embed_favicon_get_embed (EphyEmbedFavicon *favicon)
+{
+ EphyEmbed *embed;
+
+ g_return_val_if_fail (EPHY_IS_EMBED_FAVICON (favicon), NULL);
+
+ g_object_get (G_OBJECT (favicon),
+ "embed", &embed,
+ NULL);
+
+ return embed;
+}
diff --git a/embed/ephy-embed-favicon.h b/embed/ephy-embed-favicon.h
new file mode 100644
index 000000000..36f69cc82
--- /dev/null
+++ b/embed/ephy-embed-favicon.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib-object.h>
+#include <gtk/gtkimage.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "ephy-favicon.h"
+#include "ephy-embed.h"
+
+#ifndef __EPHY_EMBED_FAVICON_H
+#define __EPHY_EMBED_FAVICON_H
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_EMBED_FAVICON (ephy_embed_favicon_get_type ())
+#define EPHY_EMBED_FAVICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_FAVICON, EphyEmbedFavicon))
+#define EPHY_EMBED_FAVICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EPHY_TYPE_EMBED_FAVICON, EphyEmbedFaviconClass))
+#define EPHY_IS_EMBED_FAVICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_FAVICON))
+#define EPHY_IS_EMBED_FAVICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_FAVICON))
+#define EPHY_EMBED_FAVICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_FAVICON, EphyEmbedFaviconClass))
+
+typedef struct EphyEmbedFaviconPrivate EphyEmbedFaviconPrivate;
+
+typedef struct
+{
+ EphyFavicon parent;
+
+ EphyEmbedFaviconPrivate *priv;
+} EphyEmbedFavicon;
+
+typedef struct
+{
+ EphyFaviconClass parent_class;
+} EphyEmbedFaviconClass;
+
+GType ephy_embed_favicon_get_type (void);
+
+GtkWidget *ephy_embed_favicon_new (EphyEmbed *embed);
+
+void ephy_embed_favicon_set_embed (EphyEmbedFavicon *favicon,
+ EphyEmbed *embed);
+
+EphyEmbed *ephy_embed_favicon_get_embed (EphyEmbedFavicon *favicon);
+
+G_END_DECLS
+
+#endif /* __EPHY_EMBED_FAVICON_H */
diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c
new file mode 100644
index 000000000..a1d742587
--- /dev/null
+++ b/embed/ephy-embed-persist.c
@@ -0,0 +1,491 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include "ephy-embed-persist.h"
+
+#include "mozilla-embed.h"
+#include "mozilla-embed-persist.h"
+
+#include <bonobo/bonobo-i18n.h>
+
+enum
+{
+ COMPLETED,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_EMBED,
+ PROP_SOURCE,
+ PROP_DEST,
+ PROP_MAX_SIZE,
+ PROP_FLAGS,
+ PROP_HANDLER
+};
+
+struct EphyEmbedPersistPrivate
+{
+ char *dir;
+ char *src;
+ PersistHandlerInfo *handler;
+ EphyEmbed *embed;
+ int max_size;
+ EmbedPersistFlags flags;
+};
+
+static void
+ephy_embed_persist_class_init (EphyEmbedPersistClass *klass);
+static void
+ephy_embed_persist_init (EphyEmbedPersist *ges);
+static void
+ephy_embed_persist_finalize (GObject *object);
+static void
+ephy_embed_persist_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void
+ephy_embed_persist_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static gresult
+impl_set_source (EphyEmbedPersist *persist,
+ const char *url);
+static gresult
+impl_set_dest (EphyEmbedPersist *persist,
+ const char *dir);
+static gresult
+impl_set_max_size (EphyEmbedPersist *persist,
+ int kb_size);
+static gresult
+impl_set_embed (EphyEmbedPersist *persist,
+ EphyEmbed *embed);
+static gresult
+impl_set_flags (EphyEmbedPersist *persist,
+ EmbedPersistFlags flags);
+static gresult
+impl_set_handler (EphyEmbedPersist *persist,
+ const char *command,
+ gboolean need_terminal);
+
+static GObjectClass *parent_class = NULL;
+static guint ephy_embed_persist_signals[LAST_SIGNAL] = { 0 };
+
+GType
+ephy_embed_persist_get_type (void)
+{
+ static GType ephy_embed_persist_type = 0;
+
+ if (ephy_embed_persist_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedPersistClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_embed_persist_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EphyEmbedPersist),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_embed_persist_init
+ };
+
+ ephy_embed_persist_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyEmbedPersist",
+ &our_info, 0);
+ }
+
+ return ephy_embed_persist_type;
+}
+
+static void
+ephy_embed_persist_class_init (EphyEmbedPersistClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_embed_persist_finalize;
+ object_class->set_property = ephy_embed_persist_set_property;
+ object_class->get_property = ephy_embed_persist_get_property;
+
+ klass->set_source = impl_set_source;
+ klass->set_dest = impl_set_dest;
+ klass->set_embed = impl_set_embed;
+ klass->set_max_size = impl_set_max_size;
+ klass->set_flags = impl_set_flags;
+ klass->set_handler = impl_set_handler;
+
+ /* init signals */
+ ephy_embed_persist_signals[COMPLETED] =
+ g_signal_new ("completed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedPersistClass, completed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_object_class_install_property (object_class,
+ PROP_EMBED,
+ g_param_spec_object ("embed",
+ "Embed",
+ "The embed containing the document",
+ G_TYPE_OBJECT,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_SOURCE,
+ g_param_spec_string ("source",
+ "Source",
+ "Url of the document to save",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_DEST,
+ g_param_spec_string ("dest",
+ "Destination",
+ "Destination directory",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_MAX_SIZE,
+ g_param_spec_int ("max_size",
+ "Maxsize",
+ "Maximum size of the file",
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_FLAGS,
+ g_param_spec_int ("flags",
+ "Flags",
+ "Flags",
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_HANDLER,
+ g_param_spec_pointer ("handler",
+ "Handler",
+ "Handler",
+ G_PARAM_READWRITE));
+}
+
+static void
+ephy_embed_persist_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPersist *persist;
+ PersistHandlerInfo *h;
+
+ persist = EPHY_EMBED_PERSIST (object);
+
+ switch (prop_id)
+ {
+ case PROP_EMBED:
+ ephy_embed_persist_set_embed (persist,
+ g_value_get_object (value));
+ break;
+ case PROP_SOURCE:
+ ephy_embed_persist_set_source (persist,
+ g_value_get_string (value));
+ break;
+ case PROP_DEST:
+ ephy_embed_persist_set_dest (persist,
+ g_value_get_string (value));
+ break;
+ case PROP_MAX_SIZE:
+ ephy_embed_persist_set_max_size (persist,
+ g_value_get_int (value));
+ break;
+ case PROP_FLAGS:
+ ephy_embed_persist_set_flags
+ (persist,
+ (EmbedPersistFlags)g_value_get_int (value));
+ break;
+ case PROP_HANDLER:
+ h = (PersistHandlerInfo *)g_value_get_pointer (value);
+ ephy_embed_persist_set_handler
+ (persist, h->command, h->need_terminal);
+ break;
+ }
+}
+
+static void
+ephy_embed_persist_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPersist *persist;
+
+ persist = EPHY_EMBED_PERSIST (object);
+
+ switch (prop_id)
+ {
+ case PROP_EMBED:
+ g_value_set_object (value, persist->priv->embed);
+ break;
+ case PROP_SOURCE:
+ g_value_set_string (value, persist->priv->src);
+ break;
+ case PROP_DEST:
+ g_value_set_string (value, persist->priv->dir);
+ break;
+ case PROP_MAX_SIZE:
+ g_value_set_int (value, persist->priv->max_size);
+ break;
+ case PROP_FLAGS:
+ g_value_set_int (value, (int)persist->priv->flags);
+ break;
+ case PROP_HANDLER:
+ g_value_set_pointer (value, persist->priv->handler);
+ }
+}
+
+static void
+ephy_embed_persist_init (EphyEmbedPersist *persist)
+{
+ persist->priv = g_new0 (EphyEmbedPersistPrivate, 1);
+ persist->priv->src = NULL;
+ persist->priv->dir = NULL;
+ persist->priv->handler = NULL;
+}
+
+static void
+ephy_embed_persist_finalize (GObject *object)
+{
+ EphyEmbedPersist *persist;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_EMBED_PERSIST (object));
+
+ persist = EPHY_EMBED_PERSIST (object);
+
+ g_return_if_fail (persist->priv != NULL);
+
+ g_free (persist->priv->dir);
+ g_free (persist->priv->src);
+
+ if (persist->priv->handler)
+ {
+ g_free (persist->priv->handler->command);
+ g_free (persist->priv->handler);
+ }
+
+ g_free (persist->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+EphyEmbedPersist *
+ephy_embed_persist_new (EphyEmbed *embed)
+{
+ EphyEmbedPersist *persist;
+ GType type = 0;
+
+ type = MOZILLA_EMBED_PERSIST_TYPE;
+
+ g_assert (type != 0);
+
+ persist = EPHY_EMBED_PERSIST (g_object_new (type,
+ "embed", embed,
+ NULL));
+
+ g_return_val_if_fail (persist->priv != NULL, NULL);
+
+ return persist;
+}
+
+gresult
+ephy_embed_persist_set_source (EphyEmbedPersist *persist,
+ const char *url)
+{
+ EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
+ return klass->set_source (persist, url);
+}
+
+gresult
+ephy_embed_persist_get_source (EphyEmbedPersist *persist,
+ const char **url)
+{
+ *url = persist->priv->src;
+
+ return G_OK;
+}
+
+gresult
+ephy_embed_persist_get_dest (EphyEmbedPersist *persist,
+ const char **dir)
+{
+ *dir = persist->priv->dir;
+
+ return G_OK;
+}
+
+gresult
+ephy_embed_persist_set_dest (EphyEmbedPersist *persist,
+ const char *dir)
+{
+ EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
+ return klass->set_dest (persist, dir);
+}
+
+gresult
+ephy_embed_persist_save (EphyEmbedPersist *persist)
+{
+ EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
+ return klass->save (persist);
+}
+
+gresult
+ephy_embed_persist_set_max_size (EphyEmbedPersist *persist,
+ int kb_size)
+{
+ EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
+ return klass->set_max_size (persist, kb_size);
+}
+
+gresult
+ephy_embed_persist_set_embed (EphyEmbedPersist *persist,
+ EphyEmbed *embed)
+{
+ EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
+ return klass->set_embed (persist, embed);
+}
+
+gresult
+ephy_embed_persist_get_embed (EphyEmbedPersist *persist,
+ EphyEmbed **embed)
+{
+ *embed = persist->priv->embed;
+
+ return G_OK;
+}
+
+gresult
+ephy_embed_persist_set_flags (EphyEmbedPersist *persist,
+ EmbedPersistFlags flags)
+{
+ EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
+ return klass->set_flags (persist, flags);
+}
+
+gresult
+ephy_embed_persist_get_flags (EphyEmbedPersist *persist,
+ EmbedPersistFlags *flags)
+{
+ *flags = persist->priv->flags= persist->priv->flags;
+
+ return G_OK;
+}
+
+gresult
+ephy_embed_persist_set_handler (EphyEmbedPersist *persist,
+ const char *command,
+ gboolean need_terminal)
+{
+ EphyEmbedPersistClass *klass = EPHY_EMBED_PERSIST_GET_CLASS (persist);
+ return klass->set_handler (persist, command, need_terminal);
+}
+
+static gresult
+impl_set_handler (EphyEmbedPersist *persist,
+ const char *command,
+ gboolean need_terminal)
+{
+ persist->priv->handler = g_new0 (PersistHandlerInfo, 1);
+ persist->priv->handler->command = g_strdup (command);
+ persist->priv->handler->need_terminal = need_terminal;
+
+ g_object_notify (G_OBJECT(persist), "handler");
+
+ return G_OK;
+}
+
+static gresult
+impl_set_flags (EphyEmbedPersist *persist,
+ EmbedPersistFlags flags)
+{
+ persist->priv->flags = flags;
+
+ g_object_notify (G_OBJECT(persist), "flags");
+
+ return G_OK;
+}
+
+static gresult
+impl_set_source (EphyEmbedPersist *persist,
+ const char *url)
+{
+ persist->priv->src = g_strdup(url);
+
+ g_object_notify (G_OBJECT(persist), "source");
+
+ return G_OK;
+}
+
+static gresult
+impl_set_dest (EphyEmbedPersist *persist,
+ const char *dir)
+{
+ persist->priv->dir = g_strdup (dir);
+
+ g_object_notify (G_OBJECT(persist), "dest");
+
+ return G_OK;
+}
+
+static gresult
+impl_set_max_size (EphyEmbedPersist *persist,
+ int kb_size)
+{
+ persist->priv->max_size = kb_size;
+
+ g_object_notify (G_OBJECT(persist), "max_size");
+
+ return G_OK;
+}
+
+static gresult
+impl_set_embed (EphyEmbedPersist *persist,
+ EphyEmbed *embed)
+{
+ persist->priv->embed = embed;
+
+ g_object_notify (G_OBJECT(persist), "embed");
+
+ return G_OK;
+}
diff --git a/embed/ephy-embed-persist.h b/embed/ephy-embed-persist.h
new file mode 100644
index 000000000..2ad883647
--- /dev/null
+++ b/embed/ephy-embed-persist.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_PERSIST_H
+#define EPHY_EMBED_PERSIST_H
+
+#include "ephy-embed.h"
+
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedPersistClass EphyEmbedPersistClass;
+
+#define EPHY_EMBED_PERSIST_TYPE (ephy_embed_persist_get_type ())
+#define EPHY_EMBED_PERSIST(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_PERSIST_TYPE, EphyEmbedPersist))
+#define EPHY_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_PERSIST_TYPE, EphyEmbedPersistClass))
+#define IS_EPHY_EMBED_PERSIST(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_PERSIST_TYPE))
+#define IS_EPHY_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_PERSIST))
+#define EPHY_EMBED_PERSIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_PERSIST_TYPE, EphyEmbedPersistClass))
+
+typedef struct EphyEmbedPersist EphyEmbedPersist;
+typedef struct EphyEmbedPersistPrivate EphyEmbedPersistPrivate;
+
+typedef enum
+{
+ EMBED_PERSIST_SHOW_PROGRESS = 1 << 0,
+ EMBED_PERSIST_SAVE_CONTENT = 1 << 1,
+ EMBED_PERSIST_FROMCACHE = 1 << 2,
+ EMBED_PERSIST_BYPASSCACHE = 1 << 3,
+ EMBED_PERSIST_MAINDOC = 1 << 4
+} EmbedPersistFlags;
+
+typedef struct
+{
+ char *command;
+ gboolean need_terminal;
+} PersistHandlerInfo;
+
+struct EphyEmbedPersist
+{
+ GObject parent;
+ EphyEmbedPersistPrivate *priv;
+};
+
+struct EphyEmbedPersistClass
+{
+ GObjectClass parent_class;
+
+ void (* completed) (EphyEmbedPersist *persist);
+
+ /* Methods */
+
+ gresult (* set_source) (EphyEmbedPersist *persist,
+ const char *url);
+ gresult (* set_dest) (EphyEmbedPersist *persist,
+ const char *dir);
+ gresult (* save) (EphyEmbedPersist *persist);
+
+ gresult (* set_max_size) (EphyEmbedPersist *persist,
+ int max_size);
+
+ gresult (* set_embed) (EphyEmbedPersist *persist,
+ EphyEmbed *embed);
+
+ gresult (* set_flags) (EphyEmbedPersist *persist,
+ EmbedPersistFlags flags);
+
+ gresult (* set_handler) (EphyEmbedPersist *persist,
+ const char *command,
+ gboolean need_terminal);
+};
+
+GType ephy_embed_persist_get_type (void);
+
+EphyEmbedPersist *ephy_embed_persist_new (EphyEmbed *embed);
+
+gresult ephy_embed_persist_set_source (EphyEmbedPersist *persist,
+ const char *url);
+
+gresult ephy_embed_persist_get_source (EphyEmbedPersist *persist,
+ const char **url);
+
+gresult ephy_embed_persist_set_dest (EphyEmbedPersist *persist,
+ const char *dir);
+
+gresult ephy_embed_persist_get_dest (EphyEmbedPersist *persist,
+ const char **dir);
+
+gresult ephy_embed_persist_set_handler (EphyEmbedPersist *persist,
+ const char *handler,
+ gboolean need_terminal);
+
+gresult ephy_embed_persist_set_max_size (EphyEmbedPersist *persist,
+ int kb_size);
+
+gresult ephy_embed_persist_set_embed (EphyEmbedPersist *persist,
+ EphyEmbed *embed);
+
+gresult ephy_embed_persist_get_embed (EphyEmbedPersist *persist,
+ EphyEmbed **embed);
+
+gresult ephy_embed_persist_set_flags (EphyEmbedPersist *persist,
+ EmbedPersistFlags flags);
+
+gresult ephy_embed_persist_get_flags (EphyEmbedPersist *persist,
+ EmbedPersistFlags *flags);
+
+gresult ephy_embed_persist_save (EphyEmbedPersist *persist);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed-popup-bw.c b/embed/ephy-embed-popup-bw.c
new file mode 100644
index 000000000..553f73205
--- /dev/null
+++ b/embed/ephy-embed-popup-bw.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-embed-popup-bw.h"
+#include "ephy-gobject-misc.h"
+
+#include <gtk/gtkmain.h>
+
+enum
+{
+ PROP_0,
+ PROP_BONOBO_WINDOW
+};
+
+struct EphyEmbedPopupBWPrivate
+{
+ BonoboWindow *window;
+ GtkWidget *menu;
+};
+
+static void
+ephy_embed_popup_bw_class_init (EphyEmbedPopupBWClass *klass);
+static void
+ephy_embed_popup_bw_init (EphyEmbedPopupBW *gep);
+static void
+ephy_embed_popup_bw_finalize (GObject *object);
+static void
+ephy_embed_popup_bw_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void
+ephy_embed_popup_bw_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void
+ephy_embed_popup_bw_set_window (EphyEmbedPopupBW *p,
+ BonoboWindow *window);
+static void
+ephy_embed_popup_bw_show_impl (EphyEmbedPopup *p,
+ EphyEmbed *embed);
+
+static EphyEmbedPopupClass *parent_class = NULL;
+
+MAKE_GET_TYPE (ephy_embed_popup_bw, "EphyEmbedPopupBW", EphyEmbedPopupBW,
+ ephy_embed_popup_bw_class_init, ephy_embed_popup_bw_init, EPHY_EMBED_POPUP_TYPE);
+
+static void
+ephy_embed_popup_bw_class_init (EphyEmbedPopupBWClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = EPHY_EMBED_POPUP_CLASS (g_type_class_peek_parent (klass));
+
+ object_class->finalize = ephy_embed_popup_bw_finalize;
+ object_class->set_property = ephy_embed_popup_bw_set_property;
+ object_class->get_property = ephy_embed_popup_bw_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_BONOBO_WINDOW,
+ g_param_spec_object ("BonoboWindow",
+ "BonoboWindow",
+ "Bonobo window",
+ BONOBO_TYPE_WINDOW,
+ G_PARAM_READWRITE));
+
+ EPHY_EMBED_POPUP_CLASS (klass)->show = ephy_embed_popup_bw_show_impl;
+}
+
+static void
+ephy_embed_popup_bw_init (EphyEmbedPopupBW *gep)
+{
+ gep->priv = g_new0 (EphyEmbedPopupBWPrivate, 1);
+ gep->priv->window = NULL;
+ gep->priv->menu = NULL;
+}
+
+static void
+ephy_embed_popup_bw_finalize (GObject *object)
+{
+ EphyEmbedPopupBW *gep;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_EMBED_POPUP_BW (object));
+
+ gep = EPHY_EMBED_POPUP_BW (object);
+
+ g_return_if_fail (gep->priv != NULL);
+
+ g_free (gep->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+ephy_embed_popup_bw_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPopupBW *p = EPHY_EMBED_POPUP_BW (object);
+
+ switch (prop_id)
+ {
+ case PROP_BONOBO_WINDOW:
+ ephy_embed_popup_bw_set_window (p, g_value_get_object (value));
+ break;
+ }
+}
+
+static void
+ephy_embed_popup_bw_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPopupBW *p = EPHY_EMBED_POPUP_BW (object);
+
+ switch (prop_id)
+ {
+ case PROP_BONOBO_WINDOW:
+ g_value_set_object (value, p->priv->window);
+ break;
+ }
+}
+
+static void
+ephy_embed_popup_bw_set_window (EphyEmbedPopupBW *p,
+ BonoboWindow *window)
+{
+ p->priv->window = window;
+}
+
+EphyEmbedPopupBW *
+ephy_embed_popup_bw_new (BonoboWindow *window)
+{
+ EphyEmbedPopupBW *p;
+
+ p = EPHY_EMBED_POPUP_BW (g_object_new (EPHY_EMBED_POPUP_BW_TYPE,
+ "BonoboWindow", window,
+ NULL));
+
+ g_return_val_if_fail (p->priv != NULL, NULL);
+
+ return p;
+}
+
+static void
+ephy_embed_popup_bw_show_impl (EphyEmbedPopup *pp,
+ EphyEmbed *embed)
+{
+ EphyEmbedPopupBW *p = EPHY_EMBED_POPUP_BW (pp);
+ EphyEmbedEvent *event = ephy_embed_popup_get_event (pp);
+ guint button;
+
+ ephy_embed_popup_set_embed (pp, embed);
+
+ ephy_embed_event_get_mouse_button (event, &button);
+
+ p->priv->menu = gtk_menu_new ();
+ gtk_widget_show (p->priv->menu);
+
+ bonobo_window_add_popup (p->priv->window,
+ GTK_MENU (p->priv->menu),
+ ephy_embed_popup_get_popup_path (EPHY_EMBED_POPUP (p)));
+
+ gtk_menu_popup (GTK_MENU (p->priv->menu),
+ NULL, NULL, NULL, NULL,
+ button, gtk_get_current_event_time ());
+}
+
diff --git a/embed/ephy-embed-popup-bw.h b/embed/ephy-embed-popup-bw.h
new file mode 100644
index 000000000..49f8fecd5
--- /dev/null
+++ b/embed/ephy-embed-popup-bw.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_POPUP_BW_H
+#define EPHY_EMBED_POPUP_BW_H
+
+#include "ephy-embed-popup.h"
+#include <bonobo/bonobo-window.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedPopupBWClass EphyEmbedPopupBWClass;
+
+#define EPHY_EMBED_POPUP_BW_TYPE (ephy_embed_popup_bw_get_type ())
+#define EPHY_EMBED_POPUP_BW(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_POPUP_BW_TYPE, \
+ EphyEmbedPopupBW))
+#define EPHY_EMBED_POPUP_BW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_POPUP_BW_TYPE,\
+ EphyEmbedPopupBWClass))
+#define IS_EPHY_EMBED_POPUP_BW(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_POPUP_BW_TYPE))
+#define IS_EPHY_EMBED_POPUP_BW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_POPUP_BW))
+#define EPHY_EMBED_POPUP_BW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ EPHY_EMBED_POPUP_BW_TYPE, EphyEmbedPopupBWClass))
+
+typedef struct EphyEmbedPopupBW EphyEmbedPopupBW;
+typedef struct EphyEmbedPopupBWPrivate EphyEmbedPopupBWPrivate;
+
+struct EphyEmbedPopupBW
+{
+ EphyEmbedPopup parent;
+ EphyEmbedPopupBWPrivate *priv;
+};
+
+struct EphyEmbedPopupBWClass
+{
+ EphyEmbedPopupClass parent_class;
+};
+
+GType ephy_embed_popup_bw_get_type (void);
+EphyEmbedPopupBW * ephy_embed_popup_bw_new (BonoboWindow *window);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed-popup-control.c b/embed/ephy-embed-popup-control.c
new file mode 100644
index 000000000..a74249cc8
--- /dev/null
+++ b/embed/ephy-embed-popup-control.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Ricardo Fernández Pascual
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-embed-popup-control.h"
+#include "ephy-gobject-misc.h"
+#include "ephy-bonobo-extensions.h"
+
+#include <gtk/gtkmain.h>
+
+enum
+{
+ PROP_0,
+ PROP_BONOBO_CONTROL
+};
+
+struct EphyEmbedPopupControlPrivate
+{
+ BonoboControl *control;
+};
+
+static void
+ephy_embed_popup_control_class_init (EphyEmbedPopupControlClass *klass);
+static void
+ephy_embed_popup_control_init (EphyEmbedPopupControl *gep);
+static void
+ephy_embed_popup_control_finalize (GObject *object);
+static void
+ephy_embed_popup_control_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void
+ephy_embed_popup_control_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void
+ephy_embed_popup_control_set_control (EphyEmbedPopupControl *p,
+ BonoboControl *control);
+static void
+ephy_embed_popup_control_show_impl (EphyEmbedPopup *p,
+ EphyEmbed *embed);
+
+static EphyEmbedPopupClass *parent_class = NULL;
+
+MAKE_GET_TYPE (ephy_embed_popup_control, "EphyEmbedPopupControl", EphyEmbedPopupControl,
+ ephy_embed_popup_control_class_init, ephy_embed_popup_control_init,
+ EPHY_EMBED_POPUP_TYPE);
+
+static void
+ephy_embed_popup_control_class_init (EphyEmbedPopupControlClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = EPHY_EMBED_POPUP_CLASS (g_type_class_peek_parent (klass));
+
+ object_class->finalize = ephy_embed_popup_control_finalize;
+ object_class->set_property = ephy_embed_popup_control_set_property;
+ object_class->get_property = ephy_embed_popup_control_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_BONOBO_CONTROL,
+ g_param_spec_object ("BonoboControl",
+ "BonoboControl",
+ "Bonobo control",
+ BONOBO_TYPE_CONTROL,
+ G_PARAM_READWRITE));
+
+ EPHY_EMBED_POPUP_CLASS (klass)->show = ephy_embed_popup_control_show_impl;
+}
+
+static void
+ephy_embed_popup_control_init (EphyEmbedPopupControl *gep)
+{
+ gep->priv = g_new0 (EphyEmbedPopupControlPrivate, 1);
+ gep->priv->control = NULL;
+}
+
+static void
+ephy_embed_popup_control_finalize (GObject *object)
+{
+ EphyEmbedPopupControl *gep;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_EMBED_POPUP_CONTROL (object));
+
+ gep = EPHY_EMBED_POPUP_CONTROL (object);
+
+ g_return_if_fail (gep->priv != NULL);
+
+ g_free (gep->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+ephy_embed_popup_control_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (object);
+
+ switch (prop_id)
+ {
+ case PROP_BONOBO_CONTROL:
+ ephy_embed_popup_control_set_control (p, g_value_get_object (value));
+ break;
+ }
+}
+
+static void
+ephy_embed_popup_control_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (object);
+
+ switch (prop_id)
+ {
+ case PROP_BONOBO_CONTROL:
+ g_value_set_object (value, p->priv->control);
+ break;
+ }
+}
+
+static void
+ephy_embed_popup_control_set_control (EphyEmbedPopupControl *p,
+ BonoboControl *control)
+{
+ p->priv->control = control;
+}
+
+EphyEmbedPopupControl *
+ephy_embed_popup_control_new (BonoboControl *control)
+{
+ EphyEmbedPopupControl *p;
+
+ p = EPHY_EMBED_POPUP_CONTROL (g_object_new (EPHY_EMBED_POPUP_CONTROL_TYPE,
+ "BonoboControl", control,
+ NULL));
+
+ g_return_val_if_fail (p->priv != NULL, NULL);
+
+ return p;
+}
+
+static void
+ephy_embed_popup_control_show_impl (EphyEmbedPopup *pp,
+ EphyEmbed *embed)
+{
+ EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (pp);
+ EphyEmbedEvent *event = ephy_embed_popup_get_event (pp);
+ BonoboUIComponent *uic = bonobo_control_get_popup_ui_component (p->priv->control);
+ const char *path;
+ char *path_dst;
+ guint button;
+
+ ephy_embed_event_get_mouse_button (event, &button);
+ ephy_embed_popup_set_embed (pp, embed);
+ path = ephy_embed_popup_get_popup_path (pp);
+ path_dst = g_strdup_printf ("/popups/button%d", button);
+
+ /* this is a hack because bonobo apis for showing popups are broken */
+ ephy_bonobo_replace_path (uic, path, path_dst);
+
+ bonobo_control_do_popup (p->priv->control, button,
+ gtk_get_current_event_time ());
+
+ g_free (path_dst);
+}
+
diff --git a/embed/ephy-embed-popup-control.h b/embed/ephy-embed-popup-control.h
new file mode 100644
index 000000000..4f45efe5f
--- /dev/null
+++ b/embed/ephy-embed-popup-control.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Ricardo Fernández Pascual
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_POPUP_CONTROL_H
+#define EPHY_EMBED_POPUP_CONTROL_H
+
+#include "ephy-embed-popup.h"
+#include <bonobo/bonobo-control.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedPopupControlClass EphyEmbedPopupControlClass;
+
+#define EPHY_EMBED_POPUP_CONTROL_TYPE (ephy_embed_popup_control_get_type ())
+#define EPHY_EMBED_POPUP_CONTROL(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_POPUP_CONTROL_TYPE, \
+ EphyEmbedPopupControl))
+#define EPHY_EMBED_POPUP_CONTROL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
+ EPHY_EMBED_POPUP_CONTROL_TYPE,\
+ EphyEmbedPopupControlClass))
+#define IS_EPHY_EMBED_POPUP_CONTROL(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_POPUP_CONTROL_TYPE))
+#define IS_EPHY_EMBED_POPUP_CONTROL_CLASS(klass)(GTK_CHECK_CLASS_TYPE ((klass), \
+ EPHY_EMBED_POPUP_CONTROL))
+#define EPHY_EMBED_POPUP_CONTROL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ EPHY_EMBED_POPUP_CONTROL_TYPE, \
+ EphyEmbedPopupControlClass))
+
+typedef struct EphyEmbedPopupControl EphyEmbedPopupControl;
+typedef struct EphyEmbedPopupControlPrivate EphyEmbedPopupControlPrivate;
+
+struct EphyEmbedPopupControl
+{
+ EphyEmbedPopup parent;
+ EphyEmbedPopupControlPrivate *priv;
+};
+
+struct EphyEmbedPopupControlClass
+{
+ EphyEmbedPopupClass parent_class;
+};
+
+GType ephy_embed_popup_control_get_type (void);
+EphyEmbedPopupControl *ephy_embed_popup_control_new (BonoboControl *control);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed-popup.c b/embed/ephy-embed-popup.c
new file mode 100644
index 000000000..4710fa211
--- /dev/null
+++ b/embed/ephy-embed-popup.c
@@ -0,0 +1,623 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-embed-popup.h"
+#include "ephy-embed-event.h"
+#include "ephy-embed-utils.h"
+#include "ephy-prefs.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-bonobo-extensions.h"
+#include "ephy-file-helpers.h"
+
+#include <string.h>
+#include <bonobo/bonobo-ui-component.h>
+#include <gtk/gtkclipboard.h>
+#include <libgnome/gnome-exec.h>
+
+typedef enum
+{
+ EMBED_POPUP_INPUT,
+ EMBED_POPUP_DOCUMENT,
+ EMBED_POPUP_ELEMENT
+} EmbedPopupType;
+
+struct EphyEmbedPopupPrivate
+{
+ EphyEmbedEvent *event;
+ EphyEmbed *embed;
+ EmbedEventContext context;
+ BonoboUIComponent *ui_component;
+ char *selection;
+ EmbedPopupType popup_type;
+};
+
+static void
+ephy_embed_popup_class_init (EphyEmbedPopupClass *klass);
+static void
+ephy_embed_popup_init (EphyEmbedPopup *gep);
+static void
+ephy_embed_popup_finalize (GObject *object);
+static void
+embed_popup_copy_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_copy_email_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_copy_link_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_download_link_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_save_image_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_set_image_as_background_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_copy_image_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_save_page_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_save_background_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_open_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_reload_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+
+static void
+embed_popup_open_image_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname);
+static void
+embed_popup_copy_to_clipboard (EphyEmbedPopup *popup, const char *text);
+
+static GObjectClass *parent_class = NULL;
+
+#define DOCUMENT_POPUP_PATH "/popups/EphyEmbedDocumentPopup"
+#define ELEMENT_POPUP_PATH "/popups/EphyEmbedElementPopup"
+#define INPUT_POPUP_PATH "/popups/EphyEmbedInputPopup"
+
+#define EPHY_POPUP_NAVIGATION_ITEMS_PLACEHOLDER "/popups/EphyEmbedDocumentPopup/NavigationItems"
+#define EPHY_POPUP_LINK_ITEMS_PLACEHOLDER "/popups/EphyEmbedElementPopup/LinkItems"
+#define EPHY_POPUP_EMAIL_LINK_ITEMS_PLACEHOLDER "/popups/EphyEmbedElementPopup/EmailLinkItems"
+#define EPHY_POPUP_IMAGE_ITEMS_PLACEHOLDER "/popups/EphyEmbedElementPopup/ImageItems"
+#define EPHY_POPUP_FRAME_ITEMS_PLACEHOLDER "/popups/EphyEmbedDocumentPopup/FrameItems"
+#define EPHY_POPUP_BETWEEN_ELEMENTS1_PLACEHOLDER "/popups/EphyEmbedElementPopup/BetweenElements1"
+#define EPHY_POPUP_SAVE_BG_PATH "/commands/DPSaveBackgroundAs"
+#define EPHY_POPUP_OPEN_IMAGE_PATH "/commands/EPOpenImage"
+
+BonoboUIVerb embed_popup_verbs [] = {
+ BONOBO_UI_VERB ("EPCopyLinkLocation", (BonoboUIVerbFn)embed_popup_copy_link_location_cmd),
+ BONOBO_UI_VERB ("EPDownloadLink", (BonoboUIVerbFn)embed_popup_download_link_cmd),
+ BONOBO_UI_VERB ("EPOpenImage", (BonoboUIVerbFn)embed_popup_open_image_cmd),
+ BONOBO_UI_VERB ("EPSaveImageAs", (BonoboUIVerbFn)embed_popup_save_image_as_cmd),
+ BONOBO_UI_VERB ("EPSetImageAsBackground", (BonoboUIVerbFn)embed_popup_set_image_as_background_cmd),
+ BONOBO_UI_VERB ("EPCopyImageLocation", (BonoboUIVerbFn)embed_popup_copy_image_location_cmd),
+
+ BONOBO_UI_VERB ("DPCopyLocation", (BonoboUIVerbFn)embed_popup_copy_location_cmd),
+ BONOBO_UI_VERB ("EPCopyEmail", (BonoboUIVerbFn)embed_popup_copy_email_cmd),
+ BONOBO_UI_VERB ("DPSavePageAs", (BonoboUIVerbFn)embed_popup_save_page_as_cmd),
+ BONOBO_UI_VERB ("DPSaveBackgroundAs", (BonoboUIVerbFn)embed_popup_save_background_as_cmd),
+ BONOBO_UI_VERB ("DPOpenFrame", (BonoboUIVerbFn)embed_popup_open_frame_cmd),
+ BONOBO_UI_VERB ("DPReloadFrame", (BonoboUIVerbFn)embed_popup_reload_frame_cmd),
+
+ BONOBO_UI_VERB_END
+};
+
+GType
+ephy_embed_popup_get_type (void)
+{
+ static GType ephy_embed_popup_type = 0;
+
+ if (ephy_embed_popup_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedPopupClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_embed_popup_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EphyEmbedPopup),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_embed_popup_init
+ };
+
+
+ ephy_embed_popup_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyEmbedPopup",
+ &our_info, 0);
+ }
+
+ return ephy_embed_popup_type;
+}
+
+static void
+ephy_embed_popup_class_init (EphyEmbedPopupClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_embed_popup_finalize;
+
+ klass->show = NULL; /* abstract */
+}
+
+static void
+ephy_embed_popup_init (EphyEmbedPopup *gep)
+{
+ gep->priv = g_new0 (EphyEmbedPopupPrivate, 1);
+ gep->priv->embed = NULL;
+ gep->priv->event = NULL;
+ gep->priv->ui_component = NULL;
+}
+
+static void
+ephy_embed_popup_finalize (GObject *object)
+{
+ EphyEmbedPopup *gep;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_EMBED_POPUP (object));
+
+ gep = EPHY_EMBED_POPUP (object);
+
+ g_return_if_fail (gep->priv != NULL);
+
+ if (gep->priv->event)
+ {
+ g_object_unref (G_OBJECT (gep->priv->event));
+ }
+
+ g_free (gep->priv->selection);
+
+ g_free (gep->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+setup_element_menu (EphyEmbedPopup *p)
+{
+ gboolean is_link, is_image, is_email_link;
+
+ is_image = p->priv->context & EMBED_CONTEXT_IMAGE;
+ is_email_link = p->priv->context & EMBED_CONTEXT_EMAIL_LINK;
+ is_link = (p->priv->context & EMBED_CONTEXT_LINK) && !is_email_link;
+
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_LINK_ITEMS_PLACEHOLDER,
+ !is_link);
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_IMAGE_ITEMS_PLACEHOLDER,
+ !is_image);
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_EMAIL_LINK_ITEMS_PLACEHOLDER,
+ !is_email_link);
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_BETWEEN_ELEMENTS1_PLACEHOLDER,
+ !is_image || (!is_link && !is_email_link));
+}
+
+static void
+setup_document_menu (EphyEmbedPopup *p)
+{
+ gboolean is_framed;
+ GValue *value;
+ gboolean has_background;
+
+ ephy_embed_event_get_property (p->priv->event,
+ "framed_page", &value);
+ is_framed = g_value_get_int (value);
+ ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(p->priv->ui_component),
+ EPHY_POPUP_FRAME_ITEMS_PLACEHOLDER, !is_framed);
+
+ has_background = ephy_embed_event_has_property (p->priv->event,
+ "background_image");
+ ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(p->priv->ui_component),
+ EPHY_POPUP_SAVE_BG_PATH, !has_background);
+}
+
+void
+ephy_embed_popup_set_event (EphyEmbedPopup *p,
+ EphyEmbedEvent *event)
+{
+ EmbedEventContext context;
+
+ if (p->priv->event)
+ {
+ g_object_unref (G_OBJECT (p->priv->event));
+ }
+
+ ephy_embed_event_get_context (event, &context);
+
+ p->priv->context = context;
+
+ p->priv->event = event;
+ g_object_ref (G_OBJECT(event));
+
+ if ((p->priv->context & EMBED_CONTEXT_LINK) ||
+ (p->priv->context & EMBED_CONTEXT_EMAIL_LINK) ||
+ (p->priv->context & EMBED_CONTEXT_IMAGE))
+ {
+ setup_element_menu (p);
+ p->priv->popup_type = EMBED_POPUP_ELEMENT;
+ }
+ else if (p->priv->context & EMBED_CONTEXT_INPUT)
+ {
+ p->priv->popup_type = EMBED_POPUP_INPUT;
+ }
+ else
+ {
+ setup_document_menu (p);
+ p->priv->popup_type = EMBED_POPUP_DOCUMENT;
+ }
+}
+
+void
+ephy_embed_popup_set_embed (EphyEmbedPopup *p,
+ EphyEmbed *e)
+{
+ p->priv->embed = e;
+}
+
+EphyEmbed *
+ephy_embed_popup_get_embed (EphyEmbedPopup *p)
+{
+ return p->priv->embed;
+}
+
+void
+ephy_embed_popup_show (EphyEmbedPopup *p,
+ EphyEmbed *embed)
+{
+ EphyEmbedPopupClass *klass = EPHY_EMBED_POPUP_GET_CLASS (p);
+ return klass->show (p, embed);
+
+}
+
+void
+ephy_embed_popup_connect_verbs (EphyEmbedPopup *p,
+ BonoboUIComponent *ui_component)
+{
+
+ p->priv->ui_component = BONOBO_UI_COMPONENT (ui_component);
+
+ bonobo_ui_component_add_verb_list_with_data (BONOBO_UI_COMPONENT(ui_component),
+ embed_popup_verbs,
+ p);
+}
+
+EphyEmbedEvent *
+ephy_embed_popup_get_event (EphyEmbedPopup *p)
+{
+ g_return_val_if_fail (IS_EPHY_EMBED_POPUP (p), NULL);
+
+ return p->priv->event;
+}
+
+static void
+embed_popup_copy_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ char *location;
+ ephy_embed_get_location (popup->priv->embed, FALSE,
+ FALSE, &location);
+ embed_popup_copy_to_clipboard (popup, location);
+ g_free (location);
+}
+
+static void
+embed_popup_copy_email_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ GValue *value;
+
+ info = ephy_embed_popup_get_event (popup);
+ ephy_embed_event_get_property (info, "email", &value);
+ location = g_value_get_string (value);
+ embed_popup_copy_to_clipboard (popup, location);
+}
+
+static void
+embed_popup_copy_link_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ GValue *value;
+
+ info = ephy_embed_popup_get_event (popup);
+ ephy_embed_event_get_property (info, "link", &value);
+ location = g_value_get_string (value);
+ embed_popup_copy_to_clipboard (popup, location);
+}
+
+static void
+save_property_url (EphyEmbedPopup *popup,
+ gboolean ask_dest,
+ gboolean show_progress,
+ const char *property)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ GValue *value;
+ GtkWidget *widget;
+ GtkWidget *window;
+ EphyEmbedPersist *persist;
+
+ info = ephy_embed_popup_get_event (popup);
+ ephy_embed_event_get_property (info, property, &value);
+ location = g_value_get_string (value);
+
+ widget = GTK_WIDGET (popup->priv->embed);
+ window = gtk_widget_get_toplevel (widget);
+
+ persist = ephy_embed_persist_new (popup->priv->embed);
+
+ ephy_embed_persist_set_source (persist, location);
+
+ if (show_progress)
+ {
+ ephy_embed_persist_set_flags (persist,
+ EMBED_PERSIST_SHOW_PROGRESS);
+ }
+
+ ephy_embed_utils_save (window,
+ CONF_STATE_DOWNLOADING_DIR,
+ ask_dest,
+ FALSE,
+ persist);
+}
+
+const char *
+ephy_embed_popup_get_popup_path (EphyEmbedPopup *p)
+{
+ const char *result = NULL;
+
+ switch (p->priv->popup_type)
+ {
+ case EMBED_POPUP_INPUT:
+ result = INPUT_POPUP_PATH;
+ break;
+ case EMBED_POPUP_ELEMENT:
+ result = ELEMENT_POPUP_PATH;
+ break;
+ case EMBED_POPUP_DOCUMENT:
+ result = DOCUMENT_POPUP_PATH;
+ break;
+ }
+
+ return result;
+}
+
+/* commands */
+
+static void
+embed_popup_download_link_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ save_property_url (popup,
+ eel_gconf_get_boolean
+ (CONF_STATE_DOWNLOADING_DIR),
+ TRUE, "link");
+}
+
+static void
+embed_popup_save_image_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ save_property_url (popup, TRUE, FALSE, "image");
+}
+
+#define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename"
+#define CONF_DESKTOP_BG_TYPE "/desktop/gnome/background/picture_options"
+
+static void
+background_download_completed (EphyEmbedPersist *persist,
+ gpointer data)
+{
+ const char *bg;
+ char *type;
+
+ ephy_embed_persist_get_dest (persist, &bg);
+ eel_gconf_set_string (CONF_DESKTOP_BG_PICTURE, bg);
+
+ type = eel_gconf_get_string (CONF_DESKTOP_BG_TYPE);
+ if (type || strcmp (type, "none") == 0)
+ {
+ eel_gconf_set_string (CONF_DESKTOP_BG_TYPE,
+ "wallpaper");
+ }
+
+ g_free (type);
+
+ g_object_unref (persist);
+}
+
+static void
+embed_popup_set_image_as_background_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ char *dest, *base;
+ GValue *value;
+ EphyEmbedPersist *persist;
+
+ info = ephy_embed_popup_get_event (popup);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+
+ persist = ephy_embed_persist_new (popup->priv->embed);
+
+ base = g_path_get_basename (location);
+ dest = g_build_filename (ephy_dot_dir (),
+ base, NULL);
+
+ ephy_embed_persist_set_source (persist, location);
+ ephy_embed_persist_set_dest (persist, dest);
+
+ ephy_embed_persist_save (persist);
+
+ g_signal_connect (persist, "completed",
+ G_CALLBACK (background_download_completed),
+ NULL);
+
+ g_free (dest);
+ g_free (base);
+}
+
+static void
+embed_popup_copy_image_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ GValue *value;
+
+ info = ephy_embed_popup_get_event (popup);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+ embed_popup_copy_to_clipboard (popup, location);
+}
+
+static void
+save_url (EphyEmbedPopup *popup,
+ gboolean ask_dest,
+ gboolean show_progress,
+ const char *url)
+{
+ GtkWidget *widget;
+ GtkWidget *window;
+ EphyEmbedPersist *persist;
+
+ widget = GTK_WIDGET (popup->priv->embed);
+ window = gtk_widget_get_toplevel (widget);
+
+ persist = ephy_embed_persist_new (popup->priv->embed);
+ ephy_embed_persist_set_source (persist, url);
+
+ if (show_progress)
+ {
+ ephy_embed_persist_set_flags (persist,
+ EMBED_PERSIST_SHOW_PROGRESS);
+ }
+
+ ephy_embed_utils_save (window,
+ CONF_STATE_DOWNLOADING_DIR,
+ ask_dest,
+ FALSE,
+ persist);
+}
+
+static void
+embed_popup_save_page_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ char *location;
+
+ ephy_embed_get_location (popup->priv->embed,
+ FALSE, FALSE, &location);
+ save_url (popup, TRUE, FALSE, location);
+ g_free (location);
+}
+
+static void
+embed_popup_save_background_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ save_property_url (popup, TRUE, FALSE, "background_image");
+}
+
+static void
+embed_popup_open_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ char *location;
+
+ ephy_embed_get_location (popup->priv->embed,
+ FALSE, FALSE, &location);
+
+ ephy_embed_load_url (popup->priv->embed, location);
+}
+
+static void
+embed_popup_reload_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ /* FIXME implement */
+}
+
+static void
+embed_popup_open_image_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopup *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ GValue *value;
+
+ info = ephy_embed_popup_get_event (popup);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+
+ ephy_embed_load_url (popup->priv->embed, location);
+}
+
+static void
+embed_popup_copy_to_clipboard (EphyEmbedPopup *popup, const char *text)
+{
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_NONE),
+ text, -1);
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY),
+ text, -1);
+}
diff --git a/embed/ephy-embed-popup.h b/embed/ephy-embed-popup.h
new file mode 100644
index 000000000..6416bdfcd
--- /dev/null
+++ b/embed/ephy-embed-popup.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_POPUP_H
+#define EPHY_EMBED_POPUP_H
+
+#include "ephy-embed.h"
+#include <glib-object.h>
+#include <bonobo/bonobo-ui-component.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedPopupClass EphyEmbedPopupClass;
+
+#define EPHY_EMBED_POPUP_TYPE (ephy_embed_popup_get_type ())
+#define EPHY_EMBED_POPUP(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_POPUP_TYPE, EphyEmbedPopup))
+#define EPHY_EMBED_POPUP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_POPUP_TYPE, EphyEmbedPopupClass))
+#define IS_EPHY_EMBED_POPUP(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_POPUP_TYPE))
+#define IS_EPHY_EMBED_POPUP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_POPUP))
+#define EPHY_EMBED_POPUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_POPUP_TYPE, EphyEmbedPopupClass))
+
+typedef struct EphyEmbedPopup EphyEmbedPopup;
+typedef struct EphyEmbedPopupPrivate EphyEmbedPopupPrivate;
+
+struct EphyEmbedPopup
+{
+ GObject parent;
+ EphyEmbedPopupPrivate *priv;
+};
+
+struct EphyEmbedPopupClass
+{
+ GObjectClass parent_class;
+
+ void (*show) (EphyEmbedPopup *p,
+ EphyEmbed *embed);
+};
+
+
+
+/* this class is abstract, don't look for the constructor */
+
+GType ephy_embed_popup_get_type (void);
+void ephy_embed_popup_connect_verbs (EphyEmbedPopup *p,
+ BonoboUIComponent *ui_component);
+void ephy_embed_popup_set_embed (EphyEmbedPopup *p,
+ EphyEmbed *e);
+EphyEmbed * ephy_embed_popup_get_embed (EphyEmbedPopup *p);
+void ephy_embed_popup_set_event (EphyEmbedPopup *p,
+ EphyEmbedEvent *event);
+EphyEmbedEvent * ephy_embed_popup_get_event (EphyEmbedPopup *p);
+void ephy_embed_popup_show (EphyEmbedPopup *p,
+ EphyEmbed *embed);
+const char * ephy_embed_popup_get_popup_path (EphyEmbedPopup *p);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed-prefs.h b/embed/ephy-embed-prefs.h
new file mode 100644
index 000000000..8caa14b07
--- /dev/null
+++ b/embed/ephy-embed-prefs.h
@@ -0,0 +1,46 @@
+#define CONF_NETWORK_SOCKS_PROXY_VERSION "/apps/epiphany/network/socks_proxy_version"
+#define CONF_NETWORK_NO_PROXIES_FOR "/apps/epiphany/network/no_proxies_for"
+#define CONF_NETWORK_DISK_CACHE "/apps/epiphany/network/disk_cache_size"
+#define CONF_NETWORK_MEMORY_CACHE "/apps/epiphany/network/mem_cache_size"
+#define CONF_NETWORK_CACHE_COMPARE "/apps/epiphany/network/cache_compare"
+#define CONF_NETWORK_USER_AGENT "/apps/epiphany/network/user_agent"
+#define CONF_RENDERING_FONT "/apps/epiphany/rendering/font"
+#define CONF_RENDERING_FONT_VAR_SIZE "/apps/epiphany/rendering/font_var_size"
+#define CONF_RENDERING_FONT_FIXED_SIZE "/apps/epiphany/rendering/font_fixed_size"
+#define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/rendering/font_min_size"
+#define CONF_RENDERING_LANGUAGE "/apps/epiphany/rendering/lang"
+#define CONF_RENDERING_USE_OWN_COLORS "/apps/epiphany/rendering/use_own_colors"
+#define CONF_RENDERING_USE_SYSTEM_COLORS "/apps/epiphany/rendering/use_system_colors"
+#define CONF_RENDERING_USE_OWN_FONTS "/apps/epiphany/rendering/use_own_fonts"
+#define CONF_RENDERING_BG_COLOR "/apps/epiphany/rendering/background_color"
+#define CONF_RENDERING_TEXT_COLOR "/apps/epiphany/rendering/text_color"
+#define CONF_RENDERING_VISITED_LINKS "/apps/epiphany/rendering/visited_link_color"
+#define CONF_RENDERING_UNVISITED_LINKS "/apps/epiphany/rendering/unvisited_link_color"
+#define CONF_RENDERING_UNDERLINE_LINKS "/apps/epiphany/rendering/underline_links"
+#define CONF_FILTERING_ALLOW_POPUPS "/apps/epiphany/filtering/allow_popups"
+#define CONF_FILTERING_IMAGE_LOADING_TYPE "/apps/epiphany/filtering/image_loading_type"
+#define CONF_FILTERING_ANIMATE_TYPE "/apps/epiphany/filtering/animate_type"
+#define CONF_FILTERING_STATUSBAR_REWRITE "/apps/epiphany/filtering/statusbar_rewrite"
+#define CONF_FILTERING_JAVA_ENABLED "/apps/epiphany/filtering/java_enabled"
+#define CONF_FILTERING_JAVASCRIPT_ENABLED "/apps/epiphany/filtering/javascript_enabled"
+#define CONF_PERSISTENT_COOKIES_BEHAVIOR "/apps/epiphany/filtering/cookie_behavior"
+#define CONF_PERSISTENT_COOKIE_WARN "/apps/epiphany/filterin/cookie_warn"
+#define CONF_PERSISTENT_COOKIE_LIFETIME "/apps/epiphany/filtering/cookie_lifetime"
+#define CONF_PERSISTENT_PASSWORDS_SAVE "/apps/epiphany/filtering/passwords_save"
+#define CONF_LANGUAGE_AUTODETECT_CHARSET "/apps/epiphany/rendering/autodetect_charset"
+#define CONF_LANGUAGE_DEFAULT_CHARSET "/apps/epiphany/rendering/default_charset"
+#define CONF_RENDERING_DEFAULT_FONT "/apps/epiphany/rendering/default_font"
+#define CONF_FILTERING_DEFAULT_STATUSBAR "/apps/epiphany/filtering/default_allow_statusbar"
+
+/* These are defined gnome wide now */
+#define CONF_NETWORK_PROXY_MODE "/system/proxy/mode"
+#define CONF_NETWORK_HTTP_PROXY "/system/http_proxy/host"
+#define CONF_NETWORK_SSL_PROXY "/system/proxy/secure_host"
+#define CONF_NETWORK_FTP_PROXY "/system/proxy/ftp_host"
+#define CONF_NETWORK_SOCKS_PROXY "/system/proxy/socks_host"
+#define CONF_NETWORK_HTTP_PROXY_PORT "/system/http_proxy/port"
+#define CONF_NETWORK_SSL_PROXY_PORT "/system/proxy/secure_port"
+#define CONF_NETWORK_FTP_PROXY_PORT "/system/proxy/ftp_port"
+#define CONF_NETWORK_SOCKS_PROXY_PORT "/system/proxy/socks_port"
+#define CONF_NETWORK_PROXY_AUTO_URL "/system/proxy/autoconfig_url"
+
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
new file mode 100644
index 000000000..541e48007
--- /dev/null
+++ b/embed/ephy-embed-shell.c
@@ -0,0 +1,507 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include "ephy-embed-shell.h"
+#include "ephy-marshal.h"
+#include "ephy-favicon-cache.h"
+
+#include "mozilla-embed-shell.h"
+
+#include <string.h>
+
+enum
+{
+ NEW_WINDOW,
+ LAST_SIGNAL
+};
+
+struct EphyEmbedShellPrivate
+{
+ EphyHistory *global_history;
+ DownloaderView *downloader_view;
+ GList *embeds;
+ EphyFaviconCache *favicon_cache;
+};
+
+static void
+ephy_embed_shell_class_init (EphyEmbedShellClass *klass);
+static void
+ephy_embed_shell_init (EphyEmbedShell *ges);
+static void
+ephy_embed_shell_finalize (GObject *object);
+static void
+ephy_embed_shell_finalize (GObject *object);
+
+static EphyHistory *
+impl_get_global_history (EphyEmbedShell *shell);
+static DownloaderView *
+impl_get_downloader_view (EphyEmbedShell *shell);
+
+static GObjectClass *parent_class = NULL;
+static guint ephy_embed_shell_signals[LAST_SIGNAL] = { 0 };
+
+EphyEmbedShell *embed_shell;
+
+GType
+ephy_embed_shell_get_type (void)
+{
+ static GType ephy_embed_shell_type = 0;
+
+ if (ephy_embed_shell_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedShellClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_embed_shell_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EphyEmbedShell),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_embed_shell_init
+ };
+
+ ephy_embed_shell_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyEmbedShell",
+ &our_info, 0);
+ }
+
+ return ephy_embed_shell_type;
+}
+
+static void
+ephy_embed_shell_class_init (EphyEmbedShellClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_embed_shell_finalize;
+ klass->get_downloader_view = impl_get_downloader_view;
+ klass->get_global_history = impl_get_global_history;
+
+ ephy_embed_shell_signals[NEW_WINDOW] =
+ g_signal_new ("new_window_orphan",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedShellClass, new_window),
+ NULL, NULL,
+ ephy_marshal_VOID__POINTER_INT,
+ G_TYPE_NONE,
+ 2,
+ G_TYPE_POINTER,
+ G_TYPE_INT);
+}
+
+static void
+ephy_embed_shell_init (EphyEmbedShell *ges)
+{
+
+ /* Singleton, globally accessible */
+ embed_shell = ges;
+
+ ges->priv = g_new0 (EphyEmbedShellPrivate, 1);
+
+ ges->priv->global_history = NULL;
+ ges->priv->downloader_view = NULL;
+ ges->priv->embeds = NULL;
+
+ ges->priv->favicon_cache = NULL;
+}
+
+static void
+ephy_embed_shell_finalize (GObject *object)
+{
+ EphyEmbedShell *ges;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_EMBED_SHELL (object));
+
+ ges = EPHY_EMBED_SHELL (object);
+
+ g_return_if_fail (ges->priv != NULL);
+
+ if (ges->priv->global_history)
+ {
+ g_object_unref (ges->priv->global_history);
+ }
+
+ if (ges->priv->downloader_view)
+ {
+ g_object_remove_weak_pointer
+ (G_OBJECT(ges->priv->downloader_view),
+ (gpointer *)&ges->priv->downloader_view);
+ g_object_unref (ges->priv->downloader_view);
+ }
+
+ if (ges->priv->favicon_cache)
+ {
+ g_object_unref (G_OBJECT (ges->priv->favicon_cache));
+ }
+
+ g_free (ges->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+EphyEmbedShell *
+ephy_embed_shell_new (const char *type)
+{
+ if (strcmp (type, "mozilla") == 0)
+ {
+ return EPHY_EMBED_SHELL (g_object_new
+ (MOZILLA_EMBED_SHELL_TYPE, NULL));
+ }
+
+ g_assert_not_reached ();
+ return NULL;
+}
+
+const char *supported_embeds [] = {
+#ifdef ENABLE_MOZILLA_EMBED
+ "mozilla",
+#endif
+#ifdef ENABLE_GTKHTML_EMBED
+ "gtkhtml",
+#endif
+ NULL };
+
+const char **
+ephy_embed_shell_get_supported (void)
+{
+ return supported_embeds;
+}
+
+/**
+ * ephy_embed_shell_get_favicon_cache:
+ * @gs: a #EphyShell
+ *
+ * Returns the favicons cache.
+ *
+ * Return value: the favicons cache
+ **/
+EphyFaviconCache *
+ephy_embed_shell_get_favicon_cache (EphyEmbedShell *ees)
+{
+ if (ees->priv->favicon_cache == NULL)
+ {
+ EphyHistory *history;
+
+ history = ephy_embed_shell_get_global_history (ees);
+ ees->priv->favicon_cache = ephy_favicon_cache_new (history);
+ }
+
+ return ees->priv->favicon_cache;
+}
+
+void
+ephy_embed_shell_add_embed (EphyEmbedShell *ges,
+ EphyEmbed *embed)
+{
+ ges->priv->embeds = g_list_append (ges->priv->embeds, embed);
+}
+
+void
+ephy_embed_shell_remove_embed (EphyEmbedShell *ges,
+ EphyEmbed *embed)
+{
+ ges->priv->embeds = g_list_remove (ges->priv->embeds, embed);
+}
+
+EphyEmbed *
+ephy_embed_shell_get_active_embed (EphyEmbedShell *ges)
+{
+ GList *list = ges->priv->embeds;
+
+ g_return_val_if_fail (ges->priv->embeds != NULL, NULL);
+
+ return EPHY_EMBED (list->data);
+}
+
+GList *
+ephy_embed_shell_get_embeds (EphyEmbedShell *ges)
+{
+ return ges->priv->embeds;
+}
+
+void
+ephy_embed_shell_get_capabilities (EphyEmbedShell *shell,
+ EmbedShellCapabilities *caps)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->get_capabilities (shell, caps);
+}
+
+EphyHistory *
+ephy_embed_shell_get_global_history (EphyEmbedShell *shell)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->get_global_history (shell);
+}
+
+DownloaderView *
+ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->get_downloader_view (shell);
+}
+
+gresult
+ephy_embed_shell_clear_cache (EphyEmbedShell *shell,
+ CacheType type)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->clear_cache (shell, type);
+}
+
+gresult
+ephy_embed_shell_set_offline_mode (EphyEmbedShell *shell,
+ gboolean offline)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->set_offline_mode (shell, offline);
+}
+
+gresult
+ephy_embed_shell_load_proxy_autoconf (EphyEmbedShell *shell,
+ const char* url)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->load_proxy_autoconf (shell, url);
+}
+
+gresult
+ephy_embed_shell_get_charset_titles (EphyEmbedShell *shell,
+ const char *group,
+ GList **charsets)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->get_charset_titles (shell, group, charsets);
+}
+
+gresult
+ephy_embed_shell_get_charset_groups (EphyEmbedShell *shell,
+ GList **groups)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->get_charset_groups (shell, groups);
+}
+
+gresult
+ephy_embed_shell_get_font_list (EphyEmbedShell *shell,
+ const char *langGroup,
+ const char *fontType,
+ GList **fontList,
+ char **default_font)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->get_font_list (shell, langGroup, fontType, fontList,
+ default_font);
+}
+
+gresult
+ephy_embed_shell_set_permission (EphyEmbedShell *shell,
+ const char *url,
+ PermissionType type,
+ gboolean allow)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->set_permission (shell, url, type, allow);
+}
+
+gresult
+ephy_embed_shell_list_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList **permissions)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->list_permissions (shell, type, permissions);
+}
+
+gresult
+ephy_embed_shell_remove_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList *permissions)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->remove_permissions (shell, type, permissions);
+}
+
+gresult
+ephy_embed_shell_list_cookies (EphyEmbedShell *shell,
+ GList **cookies)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->list_cookies (shell, cookies);
+}
+
+gresult
+ephy_embed_shell_remove_cookies (EphyEmbedShell *shell,
+ GList *cookies)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->remove_cookies (shell, cookies);
+}
+
+gresult
+ephy_embed_shell_list_passwords (EphyEmbedShell *shell,
+ PasswordType type,
+ GList **passwords)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->list_passwords (shell, type, passwords);
+}
+
+gresult
+ephy_embed_shell_remove_passwords (EphyEmbedShell *shell,
+ GList *passwords,
+ PasswordType type)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->remove_passwords (shell, passwords, type);
+}
+
+/**
+ * show_file_picker: Shows a file picker. Can be configured to select a
+ * file or a directory.
+ * @parentWidget: Parent Widget for file picker.
+ * @title: Title for file picker.
+ * @directory: Initial directory to start in.
+ * @file: Initial filename to show in filepicker.
+ * @mode: Mode to run filepicker in (modeOpen, modeSave, modeGetFolder)
+ * @ret_fullpath: On a successful return, will hold the full path to selected
+ * file or directory.
+ * @file_formats: an array of FileFormat structures to fill the format chooser
+ * optionmenu. NULL if not needed. The last item must have
+ * description == NULL.
+ * @ret_file_format: where to store the index of the format selected (can be
+ * NULL)
+ * returns: TRUE for success, FALSE for failure.
+ */
+
+gresult
+ephy_embed_shell_show_file_picker (EphyEmbedShell *shell,
+ GtkWidget *parentWidget,
+ const char *title,
+ const char *directory,
+ const char *file,
+ FilePickerMode mode,
+ char **ret_fullpath,
+ gboolean *ret_save_content,
+ FileFormat *file_formats,
+ int *ret_file_format)
+{
+ EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
+ return klass->show_file_picker (shell, parentWidget, title,
+ directory, file, mode,
+ ret_fullpath, ret_save_content,
+ file_formats, ret_file_format);
+}
+
+static EphyHistory *
+impl_get_global_history (EphyEmbedShell *shell)
+{
+ if (!shell->priv->global_history)
+ {
+ shell->priv->global_history = ephy_history_new ();
+ }
+
+ return shell->priv->global_history;
+}
+
+static DownloaderView *
+impl_get_downloader_view (EphyEmbedShell *shell)
+{
+ if (!shell->priv->downloader_view)
+ {
+ shell->priv->downloader_view = downloader_view_new ();
+ g_object_add_weak_pointer
+ (G_OBJECT(shell->priv->downloader_view),
+ (gpointer *)&shell->priv->downloader_view);
+ }
+
+ return shell->priv->downloader_view;
+}
+
+gresult
+ephy_embed_shell_free_permissions (EphyEmbedShell *shell,
+ GList *permissions)
+{
+ GList *l;
+
+ for (l = permissions; l != NULL; l = l->next)
+ {
+ PermissionInfo *info = (PermissionInfo *)l->data;
+
+ g_free (info->type);
+ g_free (info->domain);
+ g_free (info);
+ }
+
+ g_list_free (permissions);
+
+ return G_OK;
+}
+
+gresult
+ephy_embed_shell_free_cookies (EphyEmbedShell *shell,
+ GList *cookies)
+{
+ GList *l;
+
+ for (l = cookies; l != NULL; l = l->next)
+ {
+ CookieInfo *info = (CookieInfo *)l->data;
+
+ g_free (info->base.type);
+ g_free (info->base.domain);
+ g_free (info->name);
+ g_free (info->value);
+ g_free (info->path);
+ g_free (info->secure);
+ g_free (info->expire);
+ g_free (info);
+ }
+
+ g_list_free (cookies);
+
+ return G_OK;
+}
+
+gresult
+ephy_embed_shell_free_passwords (EphyEmbedShell *shell,
+ GList *passwords)
+{
+ GList *l;
+
+ for (l = passwords; l != NULL; l = l->next)
+ {
+ PasswordInfo *info = (PasswordInfo *)l->data;
+ g_free (info->host);
+ g_free (info->username);
+ g_free (info);
+ }
+
+ g_list_free (passwords);
+
+ return G_OK;
+}
+
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
new file mode 100644
index 000000000..3c3b11603
--- /dev/null
+++ b/embed/ephy-embed-shell.h
@@ -0,0 +1,307 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_SHELL_H
+#define EPHY_EMBED_SHELL_H
+
+#include "ephy-embed.h"
+#include "ephy-favicon-cache.h"
+#include "ephy-history.h"
+#include "downloader-view.h"
+
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedShellClass EphyEmbedShellClass;
+
+#define EPHY_EMBED_SHELL_TYPE (ephy_embed_shell_get_type ())
+#define EPHY_EMBED_SHELL(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_SHELL_TYPE, EphyEmbedShell))
+#define EPHY_EMBED_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_SHELL_TYPE, EphyEmbedShellClass))
+#define IS_EPHY_EMBED_SHELL(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_SHELL_TYPE))
+#define IS_EPHY_EMBED_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_SHELL))
+#define EPHY_EMBED_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_SHELL_TYPE, EphyEmbedShellClass))
+
+typedef struct EphyEmbedShell EphyEmbedShell;
+typedef struct EphyEmbedShellPrivate EphyEmbedShellPrivate;
+
+extern EphyEmbedShell *embed_shell;
+
+/**
+ * FilePickerMode: What mode FilePicker should run in
+ */
+
+typedef enum
+{
+ modeOpen = 0,
+ modeSave = 1,
+ modeGetFolder =2
+} FilePickerMode;
+
+typedef struct
+{
+ /* description of the file format */
+ gchar *description;
+ /* tipical sufixes, NULL terminated */
+ gchar **extensions;
+} FileFormat;
+
+/**
+ * BlockedHost: a blocked host
+ */
+typedef struct
+{
+ gchar *type;
+ gchar *domain;
+} PermissionInfo;
+
+/**
+ * Cookie: the type of cookies
+ */
+typedef struct
+{
+ PermissionInfo base;
+ gchar *name;
+ gchar *value;
+ gchar *path;
+ gchar *secure;
+ gchar *expire;
+} CookieInfo;
+
+/**
+ * Password: a password manager entry
+ */
+typedef struct
+{
+ gchar *host;
+ gchar *username;
+} PasswordInfo;
+
+typedef struct
+{
+ const char *name;
+ const char *title;
+} CharsetInfo;
+
+/**
+ * PasswordType: To distinguish actual passwords from blocked password sites
+ */
+typedef enum
+{
+ PASSWORD_PASSWORD,
+ PASSWORD_REJECT
+} PasswordType;
+
+typedef enum
+{
+ COOKIES_PERMISSION,
+ IMAGES_PERMISSION
+} PermissionType;
+
+typedef enum
+{
+ DISK_CACHE = 2,
+ MEMORY_CACHE = 1
+} CacheType;
+
+typedef enum
+{
+ CACHE_CLEAR_CAP = 1 << 0,
+ OFFLINE_CAP = 1 << 1,
+ PROXY_AUTOCONF_CAP = 1 << 2,
+ JAVA_CONSOLE_CAP = 1 << 3,
+ JS_CONSOLE_CAP = 1 << 4,
+ CHARSETS_CAP = 1 << 5,
+ PERMISSIONS_CAP = 1 << 6,
+ COOKIES_CAP = 1 << 7,
+ PASSWORDS_CAP = 1 << 8,
+ FILEPICKER_CAP = 1 << 9
+} EmbedShellCapabilities;
+
+struct EphyEmbedShell
+{
+ GObject parent;
+ EphyEmbedShellPrivate *priv;
+};
+
+struct EphyEmbedShellClass
+{
+ GObjectClass parent_class;
+
+ void (* new_window) (EphyEmbedShell *shell,
+ EphyEmbed **new_embed,
+ EmbedChromeMask chromemask);
+
+ /* Methods */
+
+ void (* get_capabilities) (EphyEmbedShell *shell,
+ EmbedShellCapabilities *caps);
+ EphyHistory * (* get_global_history) (EphyEmbedShell *shell);
+ DownloaderView* (* get_downloader_view) (EphyEmbedShell *shell);
+ gresult (* clear_cache) (EphyEmbedShell *shell,
+ CacheType type);
+ gresult (* set_offline_mode) (EphyEmbedShell *shell,
+ gboolean offline);
+ gresult (* load_proxy_autoconf) (EphyEmbedShell *shell,
+ const char* url);
+ gresult (* show_java_console) (EphyEmbedShell *shell);
+ gresult (* show_js_console) (EphyEmbedShell *shell);
+ gresult (* get_charset_groups) (EphyEmbedShell *shell,
+ GList **groups);
+ gresult (* get_charset_titles) (EphyEmbedShell *shell,
+ const char *group,
+ GList **charsets);
+ gresult (* get_font_list) (EphyEmbedShell *shell,
+ const char *langGroup,
+ const char *fontType,
+ GList **fontList,
+ char **default_font);
+ gresult (* set_permission) (EphyEmbedShell *shell,
+ const char *url,
+ PermissionType type,
+ gboolean allow);
+ gresult (* list_permissions) (EphyEmbedShell *shell,
+ PermissionType type,
+ GList **permissions);
+ gresult (* remove_permissions) (EphyEmbedShell *shell,
+ PermissionType type,
+ GList *permissions);
+ gresult (* list_cookies) (EphyEmbedShell *shell,
+ GList **cokies);
+ gresult (* remove_cookies) (EphyEmbedShell *shell,
+ GList *cookies);
+ gresult (* list_passwords) (EphyEmbedShell *shell,
+ PasswordType type,
+ GList **passwords);
+ gresult (* remove_passwords) (EphyEmbedShell *shell,
+ GList *passwords,
+ PasswordType type);
+ gresult (* show_file_picker) (EphyEmbedShell *shell,
+ GtkWidget *parentWidget,
+ const char* title,
+ const char* directory,
+ const char* file,
+ FilePickerMode mode,
+ char **ret_fullpath,
+ gboolean *ret_save_content,
+ FileFormat *file_formats,
+ gint *ret_file_format);
+};
+
+GType ephy_embed_shell_get_type (void);
+
+EphyEmbedShell *ephy_embed_shell_new (const char *type);
+
+EphyFaviconCache *ephy_embed_shell_get_favicon_cache (EphyEmbedShell *ges);
+
+void ephy_embed_shell_add_embed (EphyEmbedShell *ges,
+ EphyEmbed *embed);
+
+void ephy_embed_shell_remove_embed (EphyEmbedShell *ges,
+ EphyEmbed *embed);
+
+EphyEmbed *ephy_embed_shell_get_active_embed (EphyEmbedShell *ges);
+
+GList *ephy_embed_shell_get_embeds (EphyEmbedShell *ges);
+
+const char **ephy_embed_shell_get_supported (void);
+
+void ephy_embed_shell_get_capabilities (EphyEmbedShell *shell,
+ EmbedShellCapabilities *caps);
+
+EphyHistory *ephy_embed_shell_get_global_history (EphyEmbedShell *shell);
+
+DownloaderView *ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell);
+
+gresult ephy_embed_shell_clear_cache (EphyEmbedShell *shell,
+ CacheType type);
+
+gresult ephy_embed_shell_set_offline_mode (EphyEmbedShell *shell,
+ gboolean offline);
+
+gresult ephy_embed_shell_load_proxy_autoconf (EphyEmbedShell *shell,
+ const char* url);
+
+/* Charsets */
+gresult ephy_embed_shell_get_charset_groups (EphyEmbedShell *shell,
+ GList **groups);
+
+gresult ephy_embed_shell_get_charset_titles (EphyEmbedShell *shell,
+ const char *group,
+ GList **charsets);
+
+gresult ephy_embed_shell_get_font_list (EphyEmbedShell *shell,
+ const char *langGroup,
+ const char *fontType,
+ GList **fontList,
+ char **default_font);
+
+/* Permissions */
+gresult ephy_embed_shell_set_permission (EphyEmbedShell *shell,
+ const char *url,
+ PermissionType type,
+ gboolean allow);
+
+gresult ephy_embed_shell_list_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList **permissions);
+
+gresult ephy_embed_shell_free_permissions (EphyEmbedShell *shell,
+ GList *permissions);
+
+gresult ephy_embed_shell_remove_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList *permissions);
+
+/* Cookies */
+gresult ephy_embed_shell_list_cookies (EphyEmbedShell *shell,
+ GList **cookies);
+
+gresult ephy_embed_shell_remove_cookies (EphyEmbedShell *shell,
+ GList *cookies);
+
+gresult ephy_embed_shell_free_cookies (EphyEmbedShell *shell,
+ GList *cookies);
+
+/* Passwords */
+gresult ephy_embed_shell_list_passwords (EphyEmbedShell *shell,
+ PasswordType type,
+ GList **passwords);
+
+gresult ephy_embed_shell_free_passwords (EphyEmbedShell *shell,
+ GList *passwords);
+
+gresult ephy_embed_shell_remove_passwords (EphyEmbedShell *shell,
+ GList *passwords,
+ PasswordType type);
+
+gresult ephy_embed_shell_show_file_picker (EphyEmbedShell *shell,
+ GtkWidget *parentWidget,
+ const char *title,
+ const char *directory,
+ const char *file,
+ FilePickerMode mode,
+ char **ret_fullpath,
+ gboolean *ret_save_content,
+ FileFormat *file_formats,
+ int *ret_file_format);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed-types.h b/embed/ephy-embed-types.h
new file mode 100644
index 000000000..adf32cc6f
--- /dev/null
+++ b/embed/ephy-embed-types.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GALEON_EMBED_TYPES_H
+#define GALEON_EMBED_TYPES_H
+
+#include "ephy-types.h"
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+ EMBED_CHROME_NONE = 0,
+ EMBED_CHROME_DEFAULT = 1 << 0,
+ EMBED_CHROME_MENUBARON = 1 << 1,
+ EMBED_CHROME_TOOLBARON = 1 << 2,
+ EMBED_CHROME_PERSONALTOOLBARON = 1 << 3,
+ EMBED_CHROME_STATUSBARON = 1 << 4,
+ EMBED_CHROME_WINDOWRAISED = 1 << 5,
+ EMBED_CHROME_WINDOWLOWERED = 1 << 6,
+ EMBED_CHROME_CENTERSCREEN = 1 << 7,
+ EMBED_CHROME_OPENASDIALOG = 1 << 8,
+ EMBED_CHROME_OPENASCHROME = 1 << 9,
+ EMBED_CHROME_OPENASPOPUP = 1 << 10,
+ EMBED_CHROME_OPENASFULLSCREEN = 1 << 11,
+ EMBED_CHROME_PPVIEWTOOLBARON = 1 << 12,
+ EMBED_CHROME_SIDEBARON = 1 << 13
+} EmbedChromeMask;
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
new file mode 100644
index 000000000..0d94e5374
--- /dev/null
+++ b/embed/ephy-embed-utils.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "eel-gconf-extensions.h"
+#include "ephy-embed-utils.h"
+#include "ephy-embed-shell.h"
+#include "ephy-bonobo-extensions.h"
+#include "ephy-gui.h"
+
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkmessagedialog.h>
+#include <bonobo/bonobo-i18n.h>
+#include <bonobo/bonobo-ui-util.h>
+#include <libgnomevfs/gnome-vfs-uri.h>
+#include <string.h>
+
+/**
+ * ephy_embed_utils_save:
+ * @window: the referrer window. Used to parent the dialogs.
+ * @default_dir_pref: the gconf path to persist the directory selected by the user.
+ * @ask_dest: ask the user the destination path
+ * @ask_content: show the user an option to save the content
+ * of the web page (images, javascript...)
+ * @persist: the #GaleonEmbedPersist referring to the url
+ *
+ * Download a save an url asking a location to the user when requested
+ **/
+void
+ephy_embed_utils_save (GtkWidget *window,
+ const char *default_dir_pref,
+ gboolean ask_dest, gboolean ask_content,
+ EphyEmbedPersist *persist)
+{
+ GnomeVFSURI *uri;
+ char *retPath = NULL;
+ char *fileName = NULL;
+ char *dirName = NULL;
+ char *retDir;
+ char *target;
+ const char *source;
+ gresult ret;
+ EphyEmbed *embed;
+ EmbedPersistFlags flags;
+ gboolean content;
+
+ g_object_ref (G_OBJECT(persist));
+
+ ephy_embed_persist_get_flags (persist, &flags);
+
+ ephy_embed_persist_get_source (persist, &source);
+
+ if (source)
+ {
+ target = g_strdup (source);
+ }
+ else
+ {
+ ephy_embed_persist_get_embed (persist, &embed);
+ g_return_if_fail (embed != NULL);
+
+ ephy_embed_get_location (embed,
+ flags &
+ EMBED_PERSIST_MAINDOC,
+ FALSE,
+ &target);
+ }
+
+ /* Get a filename from the target url */
+ uri = gnome_vfs_uri_new (target);
+ if (uri)
+ {
+ fileName = gnome_vfs_uri_extract_short_name (uri);
+ gnome_vfs_uri_unref (uri);
+ }
+
+ dirName = eel_gconf_get_string (default_dir_pref);
+ if (dirName && dirName[0] == '\0')
+ {
+ g_free (dirName);
+ dirName = NULL;
+ }
+
+ if (!dirName || strcmp (dirName,"~") == 0)
+ {
+ g_free (dirName);
+ dirName = g_strdup(g_get_home_dir ());
+ }
+
+ /* If we aren't asking for downloading dir, check that we aren't
+ * overwriting anything. If we are, pop up a warning dialog and show
+ * the filepicker if the user doesn't want to overwrite the file.
+ */
+ ret = G_FAILED;
+ if (!ask_dest)
+ {
+ retPath = g_build_filename (dirName, fileName, NULL);
+ if (ephy_gui_confirm_overwrite_file (window, retPath))
+ {
+ ret = G_OK;
+ }
+ else
+ {
+ g_free (retPath);
+ ask_dest = TRUE;
+ }
+ }
+
+ if (ask_dest)
+ {
+ /* show the file picker */
+ ret = ephy_embed_shell_show_file_picker
+ (embed_shell, window,
+ _("Select the destination filename"),
+ dirName, fileName, modeSave, &retPath,
+ ask_content ? &content : NULL,
+ NULL, NULL);
+ }
+
+ if (ret == G_OK)
+ {
+ uri = gnome_vfs_uri_new (retPath);
+ g_return_if_fail (uri != NULL);
+
+ retDir = gnome_vfs_uri_extract_dirname (uri);
+
+ if (ask_content && content)
+ {
+ flags |= EMBED_PERSIST_SAVE_CONTENT;
+ ephy_embed_persist_set_flags (persist,
+ flags);
+ }
+
+ ephy_embed_persist_set_dest (persist, retPath);
+
+ ephy_embed_persist_save (persist);
+
+ /* set default save dir */
+ eel_gconf_set_string (default_dir_pref,
+ retDir);
+
+ g_free (retDir);
+ gnome_vfs_uri_unref (uri);
+ }
+
+ g_object_unref (G_OBJECT(persist));
+
+ g_free (dirName);
+ g_free (fileName);
+ g_free (retPath);
+}
+
+static void
+build_group (GString *xml_string, const char *group, int index)
+{
+ char *tmp;
+
+ tmp = g_strdup_printf ("<submenu label=\"%s\" name=\"CharsetGroup%d\">\n",
+ group, index);
+ xml_string = g_string_append (xml_string, tmp);
+ g_free (tmp);
+}
+
+static void
+build_charset (GString *xml_string, CharsetInfo *info, int index)
+{
+ char *tmp;
+ char *verb;
+
+ verb = g_strdup_printf ("Charset%d", index);
+ tmp = g_strdup_printf ("<menuitem label=\"%s\" name=\"%s\" verb=\"%s\"/>\n",
+ info->title, verb, verb);
+ xml_string = g_string_append (xml_string, tmp);
+
+ g_free (tmp);
+ g_free (verb);
+}
+
+static void
+add_verbs (BonoboUIComponent *ui_component,
+ BonoboUIVerbFn fn, GList *verbs)
+{
+ GList *l;
+ char verb[15];
+ int charset_index = 0;
+
+ for (l = verbs; l != NULL; l = l->next)
+ {
+ EncodingMenuData *edata = (EncodingMenuData *)l->data;
+
+ sprintf (verb, "Charset%d", charset_index);
+ charset_index++;
+ bonobo_ui_component_add_verb_full
+ (ui_component, verb,
+ g_cclosure_new (G_CALLBACK (fn), edata,
+ (GClosureNotify)g_free));
+ }
+}
+
+/**
+ * ephy_embed_utils_build_charsets_submenu:
+ * @ui_component: the parent #BonoboUIComponent
+ * @path: the bonoboui path where to create the submenu.
+ * It's recommended to use a <placeholder/>
+ * @fn: callback to report the selected charsets
+ * @data: the data passed to the callback
+ *
+ * Create a charset submenu using bonobo ui.
+ **/
+void
+ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component,
+ const char *path,
+ BonoboUIVerbFn fn,
+ gpointer data)
+{
+ GList *groups;
+ GString *xml_string;
+ GList *verbs = NULL;
+ int group_index = 0;
+ int charset_index = 0;
+
+#ifdef DEBUG_MARCO
+ GTimer *timer;
+ gulong s;
+
+ timer = g_timer_new ();
+ g_timer_start(timer);
+#endif
+
+ g_return_if_fail (ephy_embed_shell_get_charset_groups (embed_shell, &groups) == G_OK);
+
+ xml_string = g_string_new (NULL);
+ g_string_append (xml_string, "<submenu name=\"Encoding\" _label=\"_Encoding\">");
+
+ for (; groups != NULL; groups = groups->next)
+ {
+ GList *charsets;
+ const char *group = (const char *)groups->data;
+
+ build_group (xml_string, group, group_index);
+
+ ephy_embed_shell_get_charset_titles (embed_shell,
+ group,
+ &charsets);
+
+ for (; charsets != NULL; charsets = charsets->next)
+ {
+ CharsetInfo *info = (CharsetInfo *) charsets->data;
+ EncodingMenuData *edata;
+
+ edata = g_new0 (EncodingMenuData, 1);
+ edata->encoding = info->name;
+ edata->data = data;
+ verbs = g_list_append (verbs, edata);
+
+ build_charset (xml_string, info, charset_index);
+ charset_index++;
+ }
+
+
+ g_list_free (charsets);
+ g_string_append (xml_string, "</submenu>");
+ group_index++;
+ }
+
+ g_string_append (xml_string, "</submenu>");
+
+ bonobo_ui_component_set_translate (ui_component, path,
+ xml_string->str, NULL);
+ add_verbs (ui_component, fn, verbs);
+
+ g_list_free (verbs);
+ g_list_free (groups);
+ g_string_free (xml_string, TRUE);
+
+#ifdef DEBUG_MARCO
+ g_timer_stop (timer);
+ g_timer_elapsed (timer, &s);
+ g_print ("Time to build charset menu: %f\n", (double)(s)/1000000);
+#endif
+}
+
+/**
+ * ephy_embed_utils_handlernotfound_dialog_run:
+ * @parent: the dialog parent window
+ *
+ * Show a dialog to warn the user that no application capable
+ * to open the specified file are found. Used in the downloader
+ * and in the mime type dialog.
+ **/
+void
+ephy_embed_utils_nohandler_dialog_run (GtkWidget *parent)
+{
+ GtkWidget *dialog;
+
+ /* FIXME mime db shortcut */
+
+ dialog = gtk_message_dialog_new
+ (GTK_WINDOW(parent),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("No available applications to open "
+ "the specified file."));
+ gtk_dialog_run (GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+}
diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h
new file mode 100644
index 000000000..19f7b72f1
--- /dev/null
+++ b/embed/ephy-embed-utils.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_UTILS_H
+#define EPHY_EMBED_UTILS_H
+
+#include "ephy-embed-persist.h"
+
+#include <gtk/gtkwidget.h>
+#include <bonobo/bonobo-ui-component.h>
+
+G_BEGIN_DECLS
+
+typedef struct
+{
+ const char *encoding;
+ gpointer data;
+} EncodingMenuData;
+
+void ephy_embed_utils_save (GtkWidget *window,
+ const char *default_dir_pref,
+ gboolean ask_dest,
+ gboolean ask_content,
+ EphyEmbedPersist *persist);
+
+void ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component,
+ const char *path,
+ BonoboUIVerbFn fn,
+ gpointer data);
+
+void ephy_embed_utils_nohandler_dialog_run (GtkWidget *parent);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
new file mode 100644
index 000000000..cb513f95c
--- /dev/null
+++ b/embed/ephy-embed.c
@@ -0,0 +1,608 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ephy-marshal.h"
+#include "ephy-embed.h"
+
+#include "mozilla-embed.h"
+#include "mozilla-embed-shell.h"
+
+enum
+{
+ NEW_WINDOW,
+ LINK_MESSAGE,
+ FAVICON,
+ JS_STATUS,
+ LOCATION,
+ TITLE,
+ PROGRESS,
+ NET_STATE,
+ VISIBILITY,
+ DESTROY_BRSR,
+ OPEN_URI,
+ SIZE_TO,
+ DOM_MOUSE_CLICK,
+ DOM_MOUSE_DOWN,
+ SECURITY_CHANGE,
+ ZOOM_CHANGE,
+ LAST_SIGNAL
+};
+
+static void
+ephy_embed_base_init (gpointer base_class);
+
+struct EphyEmbedPrivate
+{
+ gpointer dummy;
+};
+
+static guint ephy_embed_signals[LAST_SIGNAL] = { 0 };
+
+GType
+ephy_embed_get_type (void)
+{
+ static GType ephy_embed_type = 0;
+
+ if (ephy_embed_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedClass),
+ ephy_embed_base_init,
+ NULL,
+ };
+
+ ephy_embed_type = g_type_register_static (G_TYPE_INTERFACE,
+ "EphyEmbed",
+ &our_info,
+ (GTypeFlags)0);
+ }
+
+ return ephy_embed_type;
+}
+
+static void
+ephy_embed_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ if (! initialized)
+ {
+ ephy_embed_signals[NEW_WINDOW] =
+ g_signal_new ("ge_new_window",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, new_window),
+ NULL, NULL,
+ ephy_marshal_VOID__POINTER_INT,
+ G_TYPE_NONE,
+ 2,
+ G_TYPE_POINTER,
+ G_TYPE_INT);
+ ephy_embed_signals[LINK_MESSAGE] =
+ g_signal_new ("ge_link_message",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, link_message),
+ NULL, NULL,
+ ephy_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+ ephy_embed_signals[FAVICON] =
+ g_signal_new ("ge_favicon",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, favicon),
+ NULL, NULL,
+ ephy_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+ ephy_embed_signals[JS_STATUS] =
+ g_signal_new ("ge_js_status",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, js_status),
+ NULL, NULL,
+ ephy_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+ ephy_embed_signals[LOCATION] =
+ g_signal_new ("ge_location",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, location),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ ephy_embed_signals[TITLE] =
+ g_signal_new ("ge_title",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, title),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ ephy_embed_signals[PROGRESS] =
+ g_signal_new ("ge_progress",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, progress),
+ NULL, NULL,
+ ephy_marshal_VOID__STRING_INT_INT,
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_STRING,
+ G_TYPE_INT,
+ G_TYPE_INT);
+ ephy_embed_signals[NET_STATE] =
+ g_signal_new ("ge_net_state",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, net_state),
+ NULL, NULL,
+ ephy_marshal_VOID__STRING_INT,
+ G_TYPE_NONE,
+ 2,
+ G_TYPE_STRING,
+ G_TYPE_INT);
+ ephy_embed_signals[VISIBILITY] =
+ g_signal_new ("ge_visibility",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, visibility),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_BOOLEAN);
+ ephy_embed_signals[DESTROY_BRSR] =
+ g_signal_new ("ge_destroy_brsr",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyEmbedClass, destroy_brsr),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ ephy_embed_signals[OPEN_URI] =
+ g_signal_new ("ge_open_uri",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedClass, open_uri),
+ NULL, NULL,
+ ephy_marshal_INT__STRING,
+ G_TYPE_INT,
+ 1,
+ G_TYPE_STRING);
+ ephy_embed_signals[SIZE_TO] =
+ g_signal_new ("ge_size_to",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedClass, size_to),
+ NULL, NULL,
+ ephy_marshal_VOID__INT_INT,
+ G_TYPE_NONE,
+ 2,
+ G_TYPE_INT,
+ G_TYPE_INT);
+ ephy_embed_signals[DOM_MOUSE_DOWN] =
+ g_signal_new ("ge_dom_mouse_down",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedClass, dom_mouse_down),
+ NULL, NULL,
+ ephy_marshal_INT__OBJECT,
+ G_TYPE_INT,
+ 1,
+ G_TYPE_POINTER);
+ ephy_embed_signals[DOM_MOUSE_CLICK] =
+ g_signal_new ("ge_dom_mouse_click",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedClass, dom_mouse_click),
+ NULL, NULL,
+ ephy_marshal_INT__OBJECT,
+ G_TYPE_INT,
+ 1,
+ G_TYPE_POINTER);
+ ephy_embed_signals[SECURITY_CHANGE] =
+ g_signal_new ("ge_security_change",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedClass, security_change),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_INT);
+ ephy_embed_signals[ZOOM_CHANGE] =
+ g_signal_new ("ge_zoom_change",
+ EPHY_EMBED_TYPE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedClass, zoom_change),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_INT);
+ }
+}
+
+EphyEmbed *
+ephy_embed_new (GObject *shell)
+{
+ if (IS_MOZILLA_EMBED_SHELL (shell))
+ {
+ return EPHY_EMBED (g_object_new
+ (MOZILLA_EMBED_TYPE, NULL));
+ }
+
+ g_assert_not_reached ();
+
+ return NULL;
+}
+
+void
+ephy_embed_get_capabilities (EphyEmbed *embed,
+ EmbedCapabilities *caps)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ klass->get_capabilities (embed, caps);
+}
+
+gresult
+ephy_embed_load_url (EphyEmbed *embed,
+ const char *url)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->load_url (embed, url);
+}
+
+gresult
+ephy_embed_stop_load (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->stop_load (embed);
+}
+
+gresult
+ephy_embed_can_go_back (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->can_go_back (embed);
+}
+
+gresult
+ephy_embed_can_go_forward (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->can_go_forward (embed);
+}
+
+gresult
+ephy_embed_can_go_up (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->can_go_up (embed);
+}
+
+gresult
+ephy_embed_get_go_up_list (EphyEmbed *embed, GSList **l)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->get_go_up_list (embed, l);
+}
+
+gresult
+ephy_embed_go_back (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->go_back (embed);
+}
+
+gresult
+ephy_embed_go_forward (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->go_forward (embed);
+}
+
+gresult
+ephy_embed_go_up (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->go_up (embed);
+}
+
+gresult
+ephy_embed_render_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len,
+ const char *base_uri,
+ const char *mime_type)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->render_data (embed, data, len, base_uri, mime_type);
+}
+
+gresult
+ephy_embed_open_stream (EphyEmbed *embed,
+ const char *base_uri,
+ const char *mime_type)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->open_stream (embed, base_uri, mime_type);
+}
+
+gresult
+ephy_embed_append_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->append_data (embed, data, len);
+}
+
+gresult
+ephy_embed_close_stream (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->close_stream (embed);
+}
+
+gresult
+ephy_embed_get_title (EphyEmbed *embed,
+ char **title)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->get_title (embed, title);
+}
+
+gresult
+ephy_embed_get_location (EphyEmbed *embed,
+ gboolean toplevel,
+ gboolean requested,
+ char **location)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->get_location (embed, toplevel, requested, location);
+}
+
+gresult
+ephy_embed_reload (EphyEmbed *embed,
+ EmbedReloadFlags flags)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->reload (embed, flags);
+}
+
+gresult
+ephy_embed_copy_page (EphyEmbed *dest,
+ EphyEmbed *source,
+ EmbedDisplayType display_type)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (dest);
+ return klass->copy_page (dest, source, display_type);
+}
+
+gresult
+ephy_embed_grab_focus (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->grab_focus (embed);
+}
+
+gresult
+ephy_embed_get_link_tags (EphyEmbed *embed,
+ const char *link_type,
+ GList **tags)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->get_link_tags (embed, link_type, tags);
+}
+
+gresult
+ephy_embed_zoom_set (EphyEmbed *embed,
+ int zoom,
+ gboolean reflow)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->zoom_set (embed, zoom, reflow);
+}
+
+gresult
+ephy_embed_zoom_get (EphyEmbed *embed,
+ int *zoom)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->zoom_get (embed, zoom);
+}
+
+gresult
+ephy_embed_selection_can_cut (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->selection_can_cut (embed);
+}
+
+gresult
+ephy_embed_selection_can_copy (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->selection_can_copy (embed);
+}
+
+gresult
+ephy_embed_can_paste (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->can_paste (embed);
+}
+
+gresult
+ephy_embed_select_all (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->select_all (embed);
+}
+
+gresult
+ephy_embed_selection_cut (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->selection_cut (embed);
+}
+
+gresult
+ephy_embed_selection_copy (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->selection_copy (embed);
+}
+
+gresult
+ephy_embed_paste (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->paste (embed);
+}
+
+gresult
+ephy_embed_shistory_count (EphyEmbed *embed,
+ int *count)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->shistory_count (embed, count);
+}
+
+gresult
+ephy_embed_shistory_get_nth (EphyEmbed *embed,
+ int nth,
+ gboolean is_relative,
+ char **url,
+ char **title)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->shistory_get_nth (embed, nth, is_relative, url, title);
+}
+
+gresult
+ephy_embed_shistory_get_pos (EphyEmbed *embed,
+ int *pos)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->shistory_get_pos (embed, pos);
+}
+
+gresult
+ephy_embed_shistory_go_nth (EphyEmbed *embed,
+ int nth)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->shistory_go_nth (embed, nth);
+}
+
+gboolean
+ephy_embed_shistory_copy (EphyEmbed *source,
+ EphyEmbed *dest)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (source);
+ return klass->shistory_copy (source, dest);
+}
+
+gresult
+ephy_embed_scroll (EphyEmbed *embed,
+ EmbedScrollDirection direction)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->scroll (embed, direction);
+}
+
+gresult
+ephy_embed_fine_scroll (EphyEmbed *embed,
+ int horiz, int vert)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->fine_scroll (embed, horiz, vert);
+}
+
+gresult
+ephy_embed_get_security_level (EphyEmbed *embed,
+ EmbedSecurityLevel *level,
+ char **description)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->get_security_level (embed, level, description);
+}
+
+gresult
+ephy_embed_find (EphyEmbed *embed,
+ EmbedFindInfo *info)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->find (embed, info);
+}
+
+gresult
+ephy_embed_set_charset (EphyEmbed *embed,
+ const char *charset)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->set_charset (embed, charset);
+}
+
+gresult
+ephy_embed_print (EphyEmbed *embed,
+ EmbedPrintInfo *info)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->print (embed, info);
+}
+
+gresult
+ephy_embed_print_preview_close (EphyEmbed *embed)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->print_preview_close (embed);
+}
+
+gresult
+ephy_embed_print_preview_num_pages (EphyEmbed *embed, gint *retNum)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->print_preview_num_pages (embed, retNum);
+}
+
+gresult
+ephy_embed_print_preview_navigate (EphyEmbed *embed,
+ EmbedPrintPreviewNavType navType,
+ gint pageNum)
+{
+ EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
+ return klass->print_preview_navigate (embed, navType, pageNum);
+}
+
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
new file mode 100644
index 000000000..1de35d7aa
--- /dev/null
+++ b/embed/ephy-embed.h
@@ -0,0 +1,443 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EMBED_H
+#define EPHY_EMBED_H
+
+#include "ephy-embed-types.h"
+#include "ephy-embed-event.h"
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyEmbedClass EphyEmbedClass;
+
+#define EPHY_EMBED_TYPE (ephy_embed_get_type ())
+#define EPHY_EMBED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_EMBED_TYPE, EphyEmbed))
+#define EPHY_EMBED_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), EPHY_EMBED_TYPE, EphyEmbedClass))
+#define IS_EPHY_EMBED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_EMBED_TYPE))
+#define IS_EPHY_EMBED_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), EPHY_EMBED_TYPE))
+#define EPHY_EMBED_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_EMBED_TYPE, EphyEmbedClass))
+
+typedef struct _EphyEmbed EphyEmbed;
+
+typedef enum
+{
+ EMBED_STATE_UNKNOWN = 0,
+ EMBED_STATE_START = 1 << 0,
+ EMBED_STATE_REDIRECTING = 1 << 1,
+ EMBED_STATE_TRANSFERRING = 1 << 2,
+ EMBED_STATE_NEGOTIATING = 1 << 3,
+ EMBED_STATE_STOP = 1 << 4,
+
+ EMBED_STATE_IS_REQUEST = 1 << 5,
+ EMBED_STATE_IS_DOCUMENT = 1 << 6,
+ EMBED_STATE_IS_NETWORK = 1 << 7,
+ EMBED_STATE_IS_WINDOW = 1 << 8
+} EmbedState;
+
+typedef enum
+{
+ EMBED_CLIPBOARD_CAP = 1 << 0,
+ EMBED_COOKIES_CAP = 1 << 1,
+ EMBED_LINKS_CAP = 1 << 2,
+ EMBED_ZOOM_CAP = 1 << 3,
+ EMBED_PRINT_CAP = 1 << 6,
+ EMBED_FIND_CAP = 1 << 7,
+ EMBED_SCROLL_CAP = 1 << 8,
+ EMBED_SECURITY_CAP = 1 << 9,
+ EMBED_CHARSET_CAP = 1 << 10,
+ EMBED_SHISTORY_CAP = 1 << 11,
+ EMBED_FINE_SCROLL_CAP = 1 << 12
+} EmbedCapabilities;
+
+typedef struct
+{
+ char *modification_date;
+
+ /* lists of hashtables with gvalues */
+ GList *images; /* url, alt, title, width, height */
+ GList *forms; /* action, type */
+ GList *links; /* url, title, type */
+ GList *stylesheets; /* url, title */
+} EmbedPageInfo;
+
+typedef enum
+{
+ EMBED_RELOAD_NORMAL = 1 << 1,
+ EMBED_RELOAD_BYPASSCACHE = 1 << 2,
+ EMBED_RELOAD_BYPASSPROXY = 1 << 3
+} EmbedReloadFlags;
+
+typedef enum
+{
+ DISPLAY_AS_SOURCE = 1U,
+ DISPLAY_NORMAL = 2U
+} EmbedDisplayType;
+
+typedef struct
+{
+ gchar *search_string;
+ gboolean backwards;
+ gboolean wrap;
+ gboolean entire_word;
+ gboolean match_case;
+ gboolean search_frames;
+ gboolean interactive;
+} EmbedFindInfo;
+
+typedef struct
+{
+ gboolean print_to_file;
+ gchar *printer;
+ gchar *file;
+ gint paper;
+ gdouble top_margin;
+ gdouble bottom_margin;
+ gdouble left_margin;
+ gdouble right_margin;
+ gint pages;
+ gint from_page;
+ gint to_page;
+ gint frame_type;
+ gint orientation;
+ gboolean print_color;
+
+ /*
+ * &T - title
+ * &U - Document URL
+ * &D - Date/Time
+ * &P - Page Number
+ * &PT - Page Number with total Number of Pages (example: 1 of 34)
+ *
+ * So, if headerLeftStr = "&T" the title and the document URL
+ * will be printed out on the top left-hand side of each page.
+ */
+ gchar *header_left_string;
+ gchar *header_center_string;
+ gchar *header_right_string;
+ gchar *footer_left_string;
+ gchar *footer_center_string;
+ gchar *footer_right_string;
+
+ gboolean preview;
+}
+EmbedPrintInfo;
+
+typedef enum
+{
+ PRINTPREVIEW_GOTO_PAGENUM = 0,
+ PRINTPREVIEW_PREV_PAGE = 1,
+ PRINTPREVIEW_NEXT_PAGE = 2,
+ PRINTPREVIEW_HOME = 3,
+ PRINTPREVIEW_END = 4
+} EmbedPrintPreviewNavType;
+
+typedef enum
+{
+ EMBED_SCROLL_UP,
+ EMBED_SCROLL_DOWN,
+ EMBED_SCROLL_LEFT,
+ EMBED_SCROLL_RIGHT
+} EmbedScrollDirection;
+
+typedef enum
+{
+ STATE_IS_UNKNOWN,
+ STATE_IS_INSECURE,
+ STATE_IS_BROKEN,
+ STATE_IS_SECURE_MED,
+ STATE_IS_SECURE_LOW,
+ STATE_IS_SECURE_HIGH
+} EmbedSecurityLevel;
+
+struct EphyEmbedClass
+{
+ GTypeInterface base_iface;
+
+ void (* favicon) (EphyEmbed *embed,
+ const char *location);
+ void (* link_message) (EphyEmbed *embed,
+ const char *link);
+ void (* js_status) (EphyEmbed *embed,
+ const char *status);
+ void (* location) (EphyEmbed *embed);
+ void (* title) (EphyEmbed *embed);
+ void (* progress) (EphyEmbed *embed,
+ const char *uri,
+ gint curprogress,
+ gint maxprogress);
+ void (* net_state) (EphyEmbed *embed,
+ const char *uri,
+ EmbedState state);
+ void (* new_window) (EphyEmbed *embed,
+ EphyEmbed **new_embed,
+ EmbedChromeMask chromemask);
+ void (* visibility) (EphyEmbed *embed,
+ gboolean visibility);
+ void (* destroy_brsr) (EphyEmbed *embed);
+ gint (* open_uri) (EphyEmbed *embed,
+ const char *uri);
+ void (* size_to) (EphyEmbed *embed,
+ gint width,
+ gint height);
+ gint (* dom_mouse_click) (EphyEmbed *embed,
+ EphyEmbedEvent *event);
+ gint (* dom_mouse_down) (EphyEmbed *embed,
+ EphyEmbedEvent *event);
+ void (* security_change) (EphyEmbed *embed,
+ EmbedSecurityLevel level);
+ void (* zoom_change) (EphyEmbed *embed,
+ guint new_zoom);
+
+ /* Methods */
+ void (* get_capabilities) (EphyEmbed *embed,
+ EmbedCapabilities *caps);
+ gresult (* load_url) (EphyEmbed *embed,
+ const char *url);
+ gresult (* stop_load) (EphyEmbed *embed);
+ gresult (* can_go_back) (EphyEmbed *embed);
+ gresult (* can_go_forward) (EphyEmbed *embed);
+ gresult (* can_go_up) (EphyEmbed *embed);
+ gresult (* get_go_up_list) (EphyEmbed *embed, GSList **l);
+ gresult (* go_back) (EphyEmbed *embed);
+ gresult (* go_forward) (EphyEmbed *embed);
+ gresult (* go_up) (EphyEmbed *embed);
+ gresult (* render_data) (EphyEmbed *embed,
+ const char *data,
+ guint32 len,
+ const char *base_uri,
+ const char *mime_type);
+ gresult (* open_stream) (EphyEmbed *embed,
+ const char *base_uri,
+ const char *mime_type);
+ gresult (* append_data) (EphyEmbed *embed,
+ const char *data,
+ guint32 len);
+ gresult (* close_stream) (EphyEmbed *embed);
+ gresult (* get_title) (EphyEmbed *embed,
+ char **title);
+ gresult (* get_location) (EphyEmbed *embed,
+ gboolean toplevel,
+ gboolean requested,
+ char **location);
+ gresult (* reload) (EphyEmbed *embed,
+ EmbedReloadFlags flags);
+ gresult (* copy_page) (EphyEmbed *dest,
+ EphyEmbed *source,
+ EmbedDisplayType display_type);
+ gresult (* grab_focus) (EphyEmbed *embed);
+ gresult (* get_link_tags) (EphyEmbed *embed,
+ const char *link_type,
+ GList **tags);
+ gresult (* zoom_set) (EphyEmbed *embed,
+ int zoom,
+ gboolean reflow);
+ gresult (* zoom_get) (EphyEmbed *embed,
+ int *zoom);
+ gresult (* selection_can_cut) (EphyEmbed *embed);
+ gresult (* selection_can_copy) (EphyEmbed *embed);
+ gresult (* can_paste) (EphyEmbed *embed);
+ gresult (* selection_cut) (EphyEmbed *embed);
+ gresult (* selection_copy) (EphyEmbed *embed);
+ gresult (* paste) (EphyEmbed *embed);
+ gresult (* select_all) (EphyEmbed *embed);
+ gresult (* shistory_count) (EphyEmbed *embed,
+ int *count);
+ gresult (* shistory_get_nth) (EphyEmbed *embed,
+ int nth,
+ gboolean is_relative,
+ char **url,
+ char **title);
+ gresult (* shistory_get_pos) (EphyEmbed *embed,
+ int *pos);
+ gresult (* shistory_go_nth) (EphyEmbed *embed,
+ int nth);
+ gboolean (* shistory_copy) (EphyEmbed *source,
+ EphyEmbed *dest);
+ gresult (* scroll) (EphyEmbed *embed,
+ EmbedScrollDirection direction);
+ gresult (* fine_scroll) (EphyEmbed *embed,
+ int horiz, int vert);
+ gresult (* get_security_level) (EphyEmbed *embed,
+ EmbedSecurityLevel *level,
+ char **description);
+ gresult (* find) (EphyEmbed *embed,
+ EmbedFindInfo *find);
+ gresult (* print) (EphyEmbed *embed,
+ EmbedPrintInfo *info);
+ gresult (* print_preview_close) (EphyEmbed *embed);
+ gresult (* print_preview_num_pages) (EphyEmbed *embed,
+ gint *retNum);
+ gresult (* print_preview_navigate) (EphyEmbed *embed,
+ EmbedPrintPreviewNavType navType,
+ gint pageNum);
+ gresult (* set_charset) (EphyEmbed *embed,
+ const char *charset);
+};
+
+GType ephy_embed_get_type (void);
+
+/* Base */
+
+EphyEmbed *ephy_embed_new (GObject *shell);
+
+void ephy_embed_get_capabilities (EphyEmbed *embed,
+ EmbedCapabilities *caps);
+
+gresult ephy_embed_load_url (EphyEmbed *embed,
+ const char *url);
+
+gresult ephy_embed_stop_load (EphyEmbed *embed);
+
+gresult ephy_embed_can_go_back (EphyEmbed *embed);
+
+gresult ephy_embed_can_go_forward (EphyEmbed *embed);
+
+gresult ephy_embed_can_go_up (EphyEmbed *embed);
+
+gresult ephy_embed_get_go_up_list (EphyEmbed *embed,
+ GSList **l);
+
+gresult ephy_embed_go_back (EphyEmbed *embed);
+
+gresult ephy_embed_go_forward (EphyEmbed *embed);
+
+gresult ephy_embed_go_up (EphyEmbed *embed);
+
+gresult ephy_embed_render_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len,
+ const char *base_uri,
+ const char *mime_type);
+
+gresult ephy_embed_open_stream (EphyEmbed *embed,
+ const char *base_uri,
+ const char *mime_type);
+
+gresult ephy_embed_append_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len);
+
+gresult ephy_embed_close_stream (EphyEmbed *embed);
+
+gresult ephy_embed_get_title (EphyEmbed *embed,
+ char **title);
+
+gresult ephy_embed_get_location (EphyEmbed *embed,
+ gboolean toplevel,
+ gboolean requested,
+ char **location);
+
+gresult ephy_embed_reload (EphyEmbed *embed,
+ EmbedReloadFlags flags);
+
+gresult ephy_embed_copy_page (EphyEmbed *dest,
+ EphyEmbed *source,
+ EmbedDisplayType display_type);
+
+gresult ephy_embed_grab_focus (EphyEmbed *embed);
+
+/* Link */
+gresult ephy_embed_get_favicon_location (EphyEmbed *embed,
+ char **url);
+
+gresult ephy_embed_get_link_tags (EphyEmbed *embed,
+ const char *link_type,
+ GList **tags);
+
+/* Zoom */
+gresult ephy_embed_zoom_set (EphyEmbed *embed,
+ int zoom,
+ gboolean reflow);
+
+gresult ephy_embed_zoom_get (EphyEmbed *embed,
+ int *zoom);
+
+/* Clipboard */
+gresult ephy_embed_selection_can_cut (EphyEmbed *embed);
+
+gresult ephy_embed_selection_can_copy (EphyEmbed *embed);
+
+gresult ephy_embed_can_paste (EphyEmbed *embed);
+
+gresult ephy_embed_selection_cut (EphyEmbed *embed);
+
+gresult ephy_embed_selection_copy (EphyEmbed *embed);
+
+gresult ephy_embed_paste (EphyEmbed *embed);
+
+gresult ephy_embed_select_all (EphyEmbed *embed);
+
+/* Session history */
+gresult ephy_embed_shistory_count (EphyEmbed *embed,
+ int *count);
+
+gresult ephy_embed_shistory_get_nth (EphyEmbed *embed,
+ int nth,
+ gboolean is_relative,
+ char **url,
+ char **title);
+
+gresult ephy_embed_shistory_get_pos (EphyEmbed *embed,
+ int *pos);
+
+gresult ephy_embed_shistory_go_nth (EphyEmbed *embed,
+ int nth);
+
+gboolean ephy_embed_shistory_copy (EphyEmbed *source,
+ EphyEmbed *dest);
+
+/* Utils */
+
+gresult ephy_embed_scroll (EphyEmbed *embed,
+ EmbedScrollDirection direction);
+
+gresult ephy_embed_fine_scroll (EphyEmbed *embed,
+ int horiz, int vert);
+
+gresult ephy_embed_get_security_level (EphyEmbed *embed,
+ EmbedSecurityLevel *level,
+ char **description);
+
+gresult ephy_embed_find (EphyEmbed *embed,
+ EmbedFindInfo *find);
+
+gresult ephy_embed_set_charset (EphyEmbed *embed,
+ const char *charset);
+
+/* Printing */
+
+gresult ephy_embed_print (EphyEmbed *embed,
+ EmbedPrintInfo *info);
+
+gresult ephy_embed_print_preview_close (EphyEmbed *embed);
+
+gresult ephy_embed_print_preview_num_pages (EphyEmbed *embed,
+ gint *retNum);
+
+gresult ephy_embed_print_preview_navigate (EphyEmbed *embed,
+ EmbedPrintPreviewNavType navType,
+ gint pageNum);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c
new file mode 100644
index 000000000..fd3c4192b
--- /dev/null
+++ b/embed/ephy-favicon-cache.c
@@ -0,0 +1,367 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <libgnomevfs/gnome-vfs-uri.h>
+#include <libxml/tree.h>
+#include <string.h>
+#include <gtk/gtktoolbar.h>
+#include <gtk/gtkstock.h>
+#include <sys/stat.h>
+
+#include "ephy-embed-persist.h"
+#include "ephy-file-helpers.h"
+#include "ephy-favicon-cache.h"
+
+static void ephy_favicon_cache_class_init (EphyFaviconCacheClass *klass);
+static void ephy_favicon_cache_init (EphyFaviconCache *ma);
+static void ephy_favicon_cache_finalize (GObject *object);
+static void ephy_favicon_cache_insert (EphyFaviconCache *cache,
+ const char *url,
+ const char *pixbuf_location);
+static char *ephy_favicon_cache_dest (EphyFaviconCache *cache,
+ const char *url);
+static void favicon_download_completed_cb (EphyEmbedPersist *persist,
+ EphyFaviconCache *cache);
+
+struct EphyFaviconCachePrivate
+{
+ char *directory;
+
+ GdkPixbuf *default_pixbuf;
+ EphyHistory *history;
+};
+
+enum
+{
+ CHANGED,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_HISTORY
+};
+
+enum
+{
+ EPHY_NODE_PAGE_PROP_FAVICON = 100
+};
+
+static guint ephy_favicon_cache_signals[LAST_SIGNAL] = { 0 };
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_favicon_cache_get_type (void)
+{
+ static GType ephy_favicon_cache_type = 0;
+
+ if (ephy_favicon_cache_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyFaviconCacheClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) ephy_favicon_cache_class_init,
+ NULL,
+ NULL,
+ sizeof (EphyFaviconCache),
+ 0,
+ (GInstanceInitFunc) ephy_favicon_cache_init
+ };
+
+ ephy_favicon_cache_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyFaviconCache",
+ &our_info, 0);
+ }
+
+ return ephy_favicon_cache_type;
+}
+
+static void
+ephy_favicon_cache_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFaviconCache *cache = EPHY_FAVICON_CACHE (object);
+
+ switch (prop_id)
+ {
+ case PROP_HISTORY:
+ cache->priv->history = g_value_get_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+ephy_favicon_cache_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFaviconCache *cache = EPHY_FAVICON_CACHE (object);
+
+ switch (prop_id)
+ {
+ case PROP_HISTORY:
+ g_value_set_object (value, cache->priv->history);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+static void
+ephy_favicon_cache_class_init (EphyFaviconCacheClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_favicon_cache_finalize;
+ object_class->set_property = ephy_favicon_cache_set_property;
+ object_class->get_property = ephy_favicon_cache_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_HISTORY,
+ g_param_spec_object ("History",
+ "Source history",
+ "Source history",
+ EPHY_HISTORY_TYPE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+
+ ephy_favicon_cache_signals[CHANGED] =
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyFaviconCacheClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+}
+
+static void
+ephy_favicon_cache_init (EphyFaviconCache *cache)
+{
+ GtkWidget *dummy;
+
+ cache->priv = g_new0 (EphyFaviconCachePrivate, 1);
+
+ cache->priv->directory = g_build_filename (ephy_dot_dir (),
+ "favicon_cache/",
+ NULL);
+
+ if (g_file_test (cache->priv->directory, G_FILE_TEST_IS_DIR) == FALSE)
+ {
+ if (g_file_test (cache->priv->directory, G_FILE_TEST_EXISTS))
+ {
+ g_error ("Please remove %s to continue.", cache->priv->directory);
+ }
+
+ if (mkdir (cache->priv->directory, 488) != 0)
+ {
+ g_error ("Couldn't mkdir %s.", cache->priv->directory);
+ }
+ }
+
+ dummy = gtk_toolbar_new ();
+ cache->priv->default_pixbuf = gtk_widget_render_icon (dummy,
+ GTK_STOCK_JUMP_TO,
+ GTK_ICON_SIZE_MENU, NULL);
+ gtk_widget_destroy (dummy);
+}
+
+static void
+ephy_favicon_cache_finalize (GObject *object)
+{
+ EphyFaviconCache *cache;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (EPHY_IS_FAVICON_CACHE (object));
+
+ cache = EPHY_FAVICON_CACHE (object);
+
+ g_return_if_fail (cache->priv != NULL);
+
+ g_object_unref (G_OBJECT (cache->priv->default_pixbuf));
+
+ g_object_unref (cache->priv->history);
+
+ g_free (cache->priv->directory);
+
+ g_free (cache->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+EphyFaviconCache *
+ephy_favicon_cache_new (EphyHistory *history)
+{
+ EphyFaviconCache *cache;
+
+ cache = EPHY_FAVICON_CACHE (g_object_new (EPHY_TYPE_FAVICON_CACHE,
+ "History", history,
+ NULL));
+
+ g_return_val_if_fail (cache->priv != NULL, NULL);
+
+ return cache;
+}
+
+GdkPixbuf *
+ephy_favicon_cache_lookup (EphyFaviconCache *cache,
+ const char *url)
+{
+ GdkPixbuf *ret;
+
+ g_return_val_if_fail (EPHY_IS_FAVICON_CACHE (cache), NULL);
+
+ if (url == NULL)
+ {
+ return cache->priv->default_pixbuf;
+ }
+
+ ret = ephy_favicon_cache_lookup_direct (cache, url);
+
+ if (ret == NULL)
+ {
+ return cache->priv->default_pixbuf;
+ }
+
+ return ret;
+}
+
+GdkPixbuf *
+ephy_favicon_cache_lookup_direct (EphyFaviconCache *cache,
+ const char *cache_url)
+{
+ GdkPixbuf *pixbuf;
+ EphyNode *node;
+ const char *pix_file;
+
+ node = ephy_history_get_page (cache->priv->history, cache_url);
+ if (node == NULL) return NULL;
+
+ pix_file = ephy_node_get_property_string
+ (node, EPHY_NODE_PAGE_PROP_FAVICON);
+ if (pix_file == NULL) return NULL;
+
+ pixbuf = gdk_pixbuf_new_from_file (pix_file, NULL);
+ g_return_val_if_fail (pixbuf != NULL, NULL);
+
+ if (gdk_pixbuf_get_width (pixbuf) > 16 ||
+ gdk_pixbuf_get_height (pixbuf) > 16)
+ {
+ GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf, 16, 16,
+ GDK_INTERP_NEAREST);
+ g_object_unref (G_OBJECT (pixbuf));
+ pixbuf = scaled;
+ }
+
+ return pixbuf;
+}
+
+static void
+ephy_favicon_cache_insert (EphyFaviconCache *cache,
+ const char *url,
+ const char *pixbuf_location)
+{
+ EphyNode *node;
+ GValue value = { 0, };
+
+ node = ephy_history_get_page (cache->priv->history, url);
+ g_return_if_fail (node != NULL);
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, pixbuf_location);
+ ephy_node_set_property (node, EPHY_NODE_PAGE_PROP_FAVICON,
+ &value);
+ g_value_unset (&value);
+
+ g_signal_emit (G_OBJECT (cache), ephy_favicon_cache_signals[CHANGED], 0, url);
+}
+
+static char *
+ephy_favicon_cache_dest (EphyFaviconCache *cache, const char *url)
+{
+ char *slashpos, *dest, *my_url;
+
+ my_url = g_strdup (url);
+
+ while ((slashpos = strstr (my_url, "/")) != NULL)
+ *slashpos = '_';
+
+ dest = g_build_filename (cache->priv->directory, my_url, NULL);
+
+ g_free (my_url);
+
+ return dest;
+}
+
+void
+ephy_favicon_cache_insert_from_url (EphyFaviconCache *cache,
+ const char *url,
+ const char *favicon_url)
+{
+ EphyEmbedPersist *persist;
+ char *dest;
+
+ g_return_if_fail (EPHY_IS_FAVICON_CACHE (cache));
+ g_return_if_fail (url != NULL);
+ g_return_if_fail (favicon_url != NULL);
+
+ dest = ephy_favicon_cache_dest (cache, favicon_url);
+ g_return_if_fail (dest != NULL);
+
+ persist = ephy_embed_persist_new (NULL);
+
+ ephy_embed_persist_set_max_size (persist, 100);
+ ephy_embed_persist_set_flags (persist, EMBED_PERSIST_BYPASSCACHE);
+ ephy_embed_persist_set_source (persist, favicon_url);
+ ephy_embed_persist_set_dest (persist, dest);
+
+ g_object_set_data_full (G_OBJECT (persist), "url", g_strdup (url), g_free);
+ g_object_set_data_full (G_OBJECT (persist), "favicon", dest, g_free);
+
+ g_signal_connect (G_OBJECT (persist),
+ "completed",
+ G_CALLBACK (favicon_download_completed_cb),
+ cache);
+
+ ephy_embed_persist_save (persist);
+}
+
+static void
+favicon_download_completed_cb (EphyEmbedPersist *persist,
+ EphyFaviconCache *cache)
+{
+ ephy_favicon_cache_insert (cache,
+ g_object_get_data (G_OBJECT (persist), "url"),
+ g_object_get_data (G_OBJECT (persist), "favicon"));
+
+ g_object_unref (G_OBJECT (persist));
+}
diff --git a/embed/ephy-favicon-cache.h b/embed/ephy-favicon-cache.h
new file mode 100644
index 000000000..ff4ebcd56
--- /dev/null
+++ b/embed/ephy-favicon-cache.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-history.h"
+
+#include <glib-object.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#ifndef __EPHY_FAVICON_CACHE_H
+#define __EPHY_FAVICON_CACHE_H
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_FAVICON_CACHE (ephy_favicon_cache_get_type ())
+#define EPHY_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCache))
+#define EPHY_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass))
+#define EPHY_IS_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_FAVICON_CACHE))
+#define EPHY_IS_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_FAVICON_CACHE))
+#define EPHY_FAVICON_CACHE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass))
+
+typedef struct EphyFaviconCachePrivate EphyFaviconCachePrivate;
+
+typedef struct
+{
+ GObject parent;
+
+ EphyFaviconCachePrivate *priv;
+} EphyFaviconCache;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+ void (*changed) (EphyFaviconCache *cache, const char *url);
+} EphyFaviconCacheClass;
+
+GType ephy_favicon_cache_get_type (void);
+
+EphyFaviconCache *ephy_favicon_cache_new (EphyHistory *history);
+
+GdkPixbuf *ephy_favicon_cache_lookup (EphyFaviconCache *cache,
+ const char *url);
+
+GdkPixbuf *ephy_favicon_cache_lookup_direct (EphyFaviconCache *cache,
+ const char *cache_url);
+
+void ephy_favicon_cache_insert_from_url (EphyFaviconCache *cache,
+ const char *url,
+ const char *favicon_url);
+
+G_END_DECLS
+
+#endif /* __EPHY_FAVICON_CACHE_H */
diff --git a/embed/ephy-favicon.c b/embed/ephy-favicon.c
new file mode 100644
index 000000000..6670c20ab
--- /dev/null
+++ b/embed/ephy-favicon.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtkwidget.h>
+#include <string.h>
+
+#include "ephy-favicon.h"
+#include "ephy-embed-shell.h"
+
+static void ephy_favicon_class_init (EphyFaviconClass *klass);
+static void ephy_favicon_init (EphyFavicon *ma);
+static void ephy_favicon_finalize (GObject *object);
+static void ephy_favicon_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void ephy_favicon_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void ephy_favicon_update_image (EphyFavicon *favicon);
+static void cache_changed_cb (EphyFaviconCache *cache,
+ const char *url,
+ EphyFavicon *favicon);
+
+struct EphyFaviconPrivate
+{
+ EphyFaviconCache *cache;
+
+ char *url;
+};
+
+enum
+{
+ PROP_0,
+ PROP_CACHE,
+ PROP_URL
+};
+
+enum
+{
+ CHANGED,
+ LAST_SIGNAL
+};
+
+static guint ephy_favicon_signals[LAST_SIGNAL] = { 0 };
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_favicon_get_type (void)
+{
+ static GType ephy_favicon_type = 0;
+
+ if (ephy_favicon_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyFaviconClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) ephy_favicon_class_init,
+ NULL,
+ NULL,
+ sizeof (EphyFavicon),
+ 0,
+ (GInstanceInitFunc) ephy_favicon_init
+ };
+
+ ephy_favicon_type = g_type_register_static (GTK_TYPE_IMAGE,
+ "EphyFavicon",
+ &our_info, 0);
+ }
+
+ return ephy_favicon_type;
+}
+
+static void
+ephy_favicon_class_init (EphyFaviconClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_favicon_finalize;
+
+ object_class->set_property = ephy_favicon_set_property;
+ object_class->get_property = ephy_favicon_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_CACHE,
+ g_param_spec_object ("cache",
+ "Favicon cache",
+ "Favicon cache",
+ EPHY_TYPE_FAVICON_CACHE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
+ PROP_URL,
+ g_param_spec_string ("url",
+ "Associated URL",
+ "Associated URL",
+ NULL,
+ G_PARAM_READWRITE));
+
+ ephy_favicon_signals[CHANGED] =
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyFaviconClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+static void
+ephy_favicon_init (EphyFavicon *ma)
+{
+ ma->priv = g_new0 (EphyFaviconPrivate, 1);
+
+ gtk_widget_set_size_request (GTK_WIDGET (ma), 16, 16);
+}
+
+static void
+ephy_favicon_finalize (GObject *object)
+{
+ EphyFavicon *ma;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (EPHY_IS_FAVICON (object));
+
+ ma = EPHY_FAVICON (object);
+
+ g_return_if_fail (ma->priv != NULL);
+
+ g_free (ma->priv->url);
+
+ g_free (ma->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+ephy_favicon_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFavicon *favicon = EPHY_FAVICON (object);
+
+ switch (prop_id)
+ {
+ case PROP_CACHE:
+ favicon->priv->cache = g_value_get_object (value);
+
+ g_signal_connect_object (G_OBJECT (favicon->priv->cache),
+ "changed",
+ G_CALLBACK (cache_changed_cb),
+ favicon,
+ 0);
+
+ ephy_favicon_update_image (favicon);
+ break;
+ case PROP_URL:
+ g_free (favicon->priv->url);
+ favicon->priv->url = g_strdup (g_value_get_string (value));
+
+ ephy_favicon_update_image (favicon);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+ephy_favicon_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFavicon *favicon = EPHY_FAVICON (object);
+
+ switch (prop_id)
+ {
+ case PROP_CACHE:
+ g_value_set_object (value, favicon->priv->cache);
+ break;
+ case PROP_URL:
+ g_value_set_string (value, favicon->priv->url);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+GtkWidget *
+ephy_favicon_new (const char *url)
+{
+ EphyFavicon *favicon;
+ EphyFaviconCache *cache = ephy_embed_shell_get_favicon_cache (embed_shell);
+
+ g_return_val_if_fail (EPHY_IS_FAVICON_CACHE (cache), NULL);
+
+ favicon = EPHY_FAVICON (g_object_new (EPHY_TYPE_FAVICON,
+ "cache", cache,
+ "url", url,
+ NULL));
+
+ g_return_val_if_fail (favicon->priv != NULL, NULL);
+
+ return GTK_WIDGET (favicon);
+}
+
+void
+ephy_favicon_set_url (EphyFavicon *favicon,
+ const char *url)
+{
+ g_return_if_fail (EPHY_IS_FAVICON (favicon));
+
+ g_object_set (G_OBJECT (favicon),
+ "url", url,
+ NULL);
+}
+
+const char *
+ephy_favicon_get_url (EphyFavicon *favicon)
+{
+ char *url;
+
+ g_return_val_if_fail (EPHY_IS_FAVICON (favicon), NULL);
+
+ g_object_get (G_OBJECT (favicon),
+ "url", &url,
+ NULL);
+
+ return (const char *) url;
+}
+
+static void
+cache_changed_cb (EphyFaviconCache *cache,
+ const char *url,
+ EphyFavicon *favicon)
+{
+ if (strcmp (url, favicon->priv->url) == 0)
+ {
+ ephy_favicon_update_image (favicon);
+ }
+}
+
+static void
+ephy_favicon_update_image (EphyFavicon *favicon)
+{
+ GdkPixbuf *pixbuf;
+
+ g_return_if_fail (EPHY_IS_FAVICON_CACHE (favicon->priv->cache));
+
+ pixbuf = ephy_favicon_cache_lookup (favicon->priv->cache,
+ favicon->priv->url);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (favicon), pixbuf);
+
+ g_signal_emit (G_OBJECT (favicon), ephy_favicon_signals[CHANGED], 0);
+}
diff --git a/embed/ephy-favicon.h b/embed/ephy-favicon.h
new file mode 100644
index 000000000..97206cde5
--- /dev/null
+++ b/embed/ephy-favicon.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib-object.h>
+#include <gtk/gtkimage.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "ephy-favicon-cache.h"
+
+#ifndef __EPHY_FAVICON_H
+#define __EPHY_FAVICON_H
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_FAVICON (ephy_favicon_get_type ())
+#define EPHY_FAVICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_FAVICON, EphyFavicon))
+#define EPHY_FAVICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EPHY_TYPE_FAVICON, EphyFaviconClass))
+#define EPHY_IS_FAVICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_FAVICON))
+#define EPHY_IS_FAVICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_FAVICON))
+#define EPHY_FAVICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_FAVICON, EphyFaviconClass))
+
+typedef struct EphyFaviconPrivate EphyFaviconPrivate;
+
+typedef struct
+{
+ GtkImage parent;
+
+ EphyFaviconPrivate *priv;
+} EphyFavicon;
+
+typedef struct
+{
+ GtkImageClass parent_class;
+
+ void (*changed) (EphyFavicon *favicon);
+} EphyFaviconClass;
+
+GType ephy_favicon_get_type (void);
+
+GtkWidget *ephy_favicon_new (const char *url);
+
+void ephy_favicon_set_url (EphyFavicon *favicon,
+ const char *url);
+
+const char *ephy_favicon_get_url (EphyFavicon *favicon);
+
+G_END_DECLS
+
+#endif /* __EPHY_FAVICON_H */
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
new file mode 100644
index 000000000..c106b274a
--- /dev/null
+++ b/embed/ephy-history.c
@@ -0,0 +1,644 @@
+/*
+ * Copyright (C) 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-history.h"
+#include "ephy-file-helpers.h"
+#include "ephy-autocompletion-source.h"
+
+#include <time.h>
+#include <string.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnomevfs/gnome-vfs-uri.h>
+
+//#define DEBUG_MSG(x) g_print x
+#define DEBUG_MSG(x)
+
+#define EPHY_HISTORY_XML_VERSION "0.1"
+
+struct EphyHistoryPrivate
+{
+ char *xml_file;
+ EphyNode *hosts;
+ EphyNode *pages;
+ EphyNode *last_page;
+ GHashTable *hosts_hash;
+ GStaticRWLock *hosts_hash_lock;
+ GHashTable *pages_hash;
+ GStaticRWLock *pages_hash_lock;
+};
+
+enum
+{
+ ADD,
+ UPDATE,
+ REMOVE,
+ VISITED,
+ LAST_SIGNAL
+};
+
+static void
+ephy_history_class_init (EphyHistoryClass *klass);
+static void
+ephy_history_init (EphyHistory *tab);
+static void
+ephy_history_finalize (GObject *object);
+static void
+ephy_history_autocompletion_source_init (EphyAutocompletionSourceIface *iface);
+
+static GObjectClass *parent_class = NULL;
+
+static guint ephy_history_signals[LAST_SIGNAL] = { 0 };
+
+GType
+ephy_history_get_type (void)
+{
+ static GType ephy_history_type = 0;
+
+ if (ephy_history_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyHistoryClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_history_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (EphyHistory),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_history_init
+ };
+
+ static const GInterfaceInfo autocompletion_source_info =
+ {
+ (GInterfaceInitFunc) ephy_history_autocompletion_source_init,
+ NULL,
+ NULL
+ };
+
+ ephy_history_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyHistory",
+ &our_info, 0);
+
+ g_type_add_interface_static (ephy_history_type,
+ EPHY_TYPE_AUTOCOMPLETION_SOURCE,
+ &autocompletion_source_info);
+ }
+
+ return ephy_history_type;
+}
+
+static void
+ephy_history_autocompletion_source_set_basic_key (EphyAutocompletionSource *source,
+ const gchar *basic_key)
+{
+ /* nothing to do here */
+}
+
+static void
+ephy_history_autocompletion_source_foreach (EphyAutocompletionSource *source,
+ const gchar *current_text,
+ EphyAutocompletionSourceForeachFunc func,
+ gpointer data)
+{
+ GPtrArray *children;
+ int i;
+ EphyHistory *eb = EPHY_HISTORY (source);
+
+ children = ephy_node_get_children (eb->priv->pages);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+ const char *url, *title;
+
+ kid = g_ptr_array_index (children, i);
+ url = ephy_node_get_property_string
+ (kid, EPHY_NODE_PAGE_PROP_LOCATION);
+ title = ephy_node_get_property_string
+ (kid, EPHY_NODE_PAGE_PROP_TITLE);
+
+ func (source, url,
+ url, url, FALSE,
+ FALSE, 0, data);
+ }
+ ephy_node_thaw (eb->priv->pages);
+}
+
+static void
+ephy_history_emit_data_changed (EphyHistory *eb)
+{
+ g_signal_emit_by_name (eb, "data-changed");
+}
+
+static void
+ephy_history_autocompletion_source_init (EphyAutocompletionSourceIface *iface)
+{
+ iface->foreach = ephy_history_autocompletion_source_foreach;
+ iface->set_basic_key = ephy_history_autocompletion_source_set_basic_key;
+}
+
+static void
+ephy_history_class_init (EphyHistoryClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_history_finalize;
+
+ ephy_history_signals[VISITED] =
+ g_signal_new ("visited",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyHistoryClass, visited),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+}
+
+static void
+ephy_history_load (EphyHistory *eb)
+{
+ xmlDocPtr doc;
+ xmlNodePtr root, child;
+ char *tmp;
+
+ if (g_file_test (eb->priv->xml_file, G_FILE_TEST_EXISTS) == FALSE)
+ return;
+
+ doc = xmlParseFile (eb->priv->xml_file);
+ g_assert (doc != NULL);
+
+ root = xmlDocGetRootElement (doc);
+
+ tmp = xmlGetProp (root, "version");
+ g_assert (tmp != NULL && strcmp (tmp, EPHY_HISTORY_XML_VERSION) == 0);
+ g_free (tmp);
+
+ for (child = root->children; child != NULL; child = child->next)
+ {
+ EphyNode *node;
+
+ node = ephy_node_new_from_xml (child);
+ }
+
+ xmlFreeDoc (doc);
+}
+
+static void
+ephy_history_save (EphyHistory *eb)
+{
+ xmlDocPtr doc;
+ xmlNodePtr root;
+ GPtrArray *children;
+ int i;
+
+ DEBUG_MSG (("Saving history\n"));
+
+ /* save nodes to xml */
+ xmlIndentTreeOutput = TRUE;
+ doc = xmlNewDoc ("1.0");
+
+ root = xmlNewDocNode (doc, NULL, "ephy_history", NULL);
+ xmlSetProp (root, "version", EPHY_HISTORY_XML_VERSION);
+ xmlDocSetRootElement (doc, root);
+
+ children = ephy_node_get_children (eb->priv->hosts);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+
+ kid = g_ptr_array_index (children, i);
+
+ ephy_node_save_to_xml (kid, root);
+ }
+ ephy_node_thaw (eb->priv->hosts);
+
+ children = ephy_node_get_children (eb->priv->pages);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+
+ kid = g_ptr_array_index (children, i);
+
+ ephy_node_save_to_xml (kid, root);
+ }
+ ephy_node_thaw (eb->priv->pages);
+
+ xmlSaveFormatFile (eb->priv->xml_file, doc, 1);
+}
+
+static void
+hosts_added_cb (EphyNode *node,
+ EphyNode *child,
+ EphyHistory *eb)
+{
+ g_static_rw_lock_writer_lock (eb->priv->hosts_hash_lock);
+
+ g_hash_table_insert (eb->priv->hosts_hash,
+ (char *) ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_TITLE),
+ child);
+
+ g_static_rw_lock_writer_unlock (eb->priv->hosts_hash_lock);
+}
+
+static void
+hosts_removed_cb (EphyNode *node,
+ EphyNode *child,
+ EphyHistory *eb)
+{
+ g_static_rw_lock_writer_lock (eb->priv->hosts_hash_lock);
+
+ g_hash_table_remove (eb->priv->hosts_hash,
+ ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_TITLE));
+
+ g_static_rw_lock_writer_unlock (eb->priv->hosts_hash_lock);
+}
+
+static void
+pages_added_cb (EphyNode *node,
+ EphyNode *child,
+ EphyHistory *eb)
+{
+ g_static_rw_lock_writer_lock (eb->priv->pages_hash_lock);
+
+ g_hash_table_insert (eb->priv->pages_hash,
+ (char *) ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION),
+ child);
+
+ g_static_rw_lock_writer_unlock (eb->priv->pages_hash_lock);
+}
+
+static void
+pages_removed_cb (EphyNode *node,
+ EphyNode *child,
+ EphyHistory *eb)
+{
+ g_static_rw_lock_writer_lock (eb->priv->pages_hash_lock);
+
+ g_hash_table_remove (eb->priv->pages_hash,
+ ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION));
+
+ g_static_rw_lock_writer_unlock (eb->priv->pages_hash_lock);
+}
+
+static void
+ephy_history_init (EphyHistory *eb)
+{
+ eb->priv = g_new0 (EphyHistoryPrivate, 1);
+
+ eb->priv->xml_file = g_build_filename (ephy_dot_dir (),
+ "ephy-history.xml",
+ NULL);
+
+ ephy_node_system_init ();
+
+ eb->priv->pages_hash = g_hash_table_new (g_str_hash,
+ g_str_equal);
+ eb->priv->pages_hash_lock = g_new0 (GStaticRWLock, 1);
+ g_static_rw_lock_init (eb->priv->pages_hash_lock);
+
+ eb->priv->hosts_hash = g_hash_table_new (g_str_hash,
+ g_str_equal);
+ eb->priv->hosts_hash_lock = g_new0 (GStaticRWLock, 1);
+ g_static_rw_lock_init (eb->priv->hosts_hash_lock);
+
+ /* Bookmarks */
+ eb->priv->pages = ephy_node_new ();
+ ephy_node_ref (eb->priv->pages);
+ g_signal_connect_object (G_OBJECT (eb->priv->pages),
+ "child_added",
+ G_CALLBACK (pages_added_cb),
+ G_OBJECT (eb),
+ 0);
+ g_signal_connect_object (G_OBJECT (eb->priv->pages),
+ "child_removed",
+ G_CALLBACK (pages_removed_cb),
+ G_OBJECT (eb),
+ 0);
+
+ /* Hosts */
+ eb->priv->hosts = ephy_node_new ();
+ ephy_node_ref (eb->priv->hosts);
+ g_signal_connect_object (G_OBJECT (eb->priv->hosts),
+ "child_added",
+ G_CALLBACK (hosts_added_cb),
+ G_OBJECT (eb),
+ 0);
+ g_signal_connect_object (G_OBJECT (eb->priv->hosts),
+ "child_removed",
+ G_CALLBACK (hosts_removed_cb),
+ G_OBJECT (eb),
+ 0);
+
+ ephy_history_load (eb);
+ ephy_history_emit_data_changed (eb);
+}
+
+static void
+ephy_history_finalize (GObject *object)
+{
+ EphyHistory *eb;
+
+ g_return_if_fail (IS_EPHY_HISTORY (object));
+
+ eb = EPHY_HISTORY (object);
+
+ g_return_if_fail (eb->priv != NULL);
+
+ ephy_history_save (eb);
+
+ ephy_node_unref (eb->priv->pages);
+ ephy_node_unref (eb->priv->hosts);
+
+ g_hash_table_destroy (eb->priv->pages_hash);
+ g_static_rw_lock_free (eb->priv->pages_hash_lock);
+ g_hash_table_destroy (eb->priv->hosts_hash);
+ g_static_rw_lock_free (eb->priv->hosts_hash_lock);
+
+ g_free (eb->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+EphyHistory *
+ephy_history_new ()
+{
+ EphyHistory *tab;
+
+ tab = EPHY_HISTORY (g_object_new (EPHY_HISTORY_TYPE, NULL));
+
+ return tab;
+}
+
+static EphyNode *
+ephy_history_add_host (EphyHistory *eh, const char *url)
+{
+ EphyNode *host;
+ GnomeVFSURI *vfs_uri = NULL;
+ const char *host_name = NULL;
+ char *host_location = NULL;
+ GTime now;
+ GValue value = { 0, };
+ int visits;
+
+ now = time (NULL);
+
+ /* Build an host name */
+ if (!g_ascii_strncasecmp (url, "file://", 7))
+ {
+ host_name = _("Local files");
+ host_location = g_strdup ("file://");
+ }
+ else
+ {
+ vfs_uri = gnome_vfs_uri_new (url);
+ if (vfs_uri != NULL)
+ {
+ host_name = gnome_vfs_uri_get_host_name (vfs_uri);
+ host_location = gnome_vfs_uri_to_string
+ (vfs_uri, GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER);
+ }
+
+ if (host_name == NULL)
+ {
+ host_name = _("Other");
+ host_location = g_strdup ("about:blank");
+ }
+ }
+
+ g_static_rw_lock_reader_lock (eh->priv->hosts_hash_lock);
+ host = g_hash_table_lookup (eh->priv->hosts_hash, host_name);
+ g_static_rw_lock_reader_unlock (eh->priv->hosts_hash_lock);
+
+ if (!host)
+ {
+ host = ephy_node_new ();
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, host_name);
+ ephy_node_set_property (host, EPHY_NODE_PAGE_PROP_TITLE,
+ &value);
+ g_value_unset (&value);
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, host_location);
+ ephy_node_set_property (host, EPHY_NODE_PAGE_PROP_LOCATION,
+ &value);
+ g_value_unset (&value);
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, now);
+ ephy_node_set_property (host, EPHY_NODE_PAGE_PROP_FIRST_VISIT,
+ &value);
+ g_value_unset (&value);
+
+ ephy_node_add_child (eh->priv->hosts, host);
+ }
+
+ visits = ephy_node_get_property_int
+ (host, EPHY_NODE_PAGE_PROP_VISITS);
+ if (visits < 0) visits = 0;
+ visits++;
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, visits);
+ ephy_node_set_property (host, EPHY_NODE_PAGE_PROP_VISITS,
+ &value);
+ g_value_unset (&value);
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, now);
+ ephy_node_set_property (host, EPHY_NODE_PAGE_PROP_LAST_VISIT,
+ &value);
+ g_value_unset (&value);
+
+ if (vfs_uri)
+ {
+ gnome_vfs_uri_unref (vfs_uri);
+ }
+
+ g_free (host_location);
+
+ return host;
+}
+
+static void
+ephy_history_visited (EphyHistory *eh, EphyNode *node)
+{
+ GValue value = { 0, };
+ GTime now;
+ int visits;
+ const char *url;
+
+ now = time (NULL);
+
+ url = ephy_node_get_property_string
+ (node, EPHY_NODE_PAGE_PROP_LOCATION);
+
+ visits = ephy_node_get_property_int
+ (node, EPHY_NODE_PAGE_PROP_VISITS);
+ if (visits < 0) visits = 0;
+ visits++;
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, visits);
+ ephy_node_set_property (node, EPHY_NODE_PAGE_PROP_VISITS,
+ &value);
+ g_value_unset (&value);
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, now);
+ ephy_node_set_property (node, EPHY_NODE_PAGE_PROP_LAST_VISIT,
+ &value);
+ if (visits == 1)
+ {
+ ephy_node_set_property
+ (node, EPHY_NODE_PAGE_PROP_FIRST_VISIT, &value);
+ }
+ g_value_unset (&value);
+
+ eh->priv->last_page = node;
+
+ g_signal_emit (G_OBJECT (eh), ephy_history_signals[VISITED], 0, url);
+ ephy_history_emit_data_changed (eh);
+}
+
+int
+ephy_history_get_page_visits (EphyHistory *gh,
+ const char *url)
+{
+ EphyNode *node;
+ int visits;
+
+ node = ephy_history_get_page (gh, url);
+
+ visits = ephy_node_get_property_int
+ (node, EPHY_NODE_PAGE_PROP_VISITS);
+ if (visits < 0) visits = 0;
+ visits++;
+
+ return visits;
+}
+
+void
+ephy_history_add_page (EphyHistory *eb,
+ const char *url)
+{
+ EphyNode *bm, *node, *host;
+ GValue value = { 0, };
+
+ node = ephy_history_get_page (eb, url);
+ if (node)
+ {
+ ephy_history_visited (eb, node);
+ return;
+ }
+
+ bm = ephy_node_new ();
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, url);
+ ephy_node_set_property (bm, EPHY_NODE_PAGE_PROP_LOCATION,
+ &value);
+ ephy_node_set_property (bm, EPHY_NODE_PAGE_PROP_TITLE,
+ &value);
+ g_value_unset (&value);
+
+ host = ephy_history_add_host (eb, url);
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, ephy_node_get_id (host));
+ ephy_node_set_property (bm, EPHY_NODE_PAGE_PROP_HOST_ID,
+ &value);
+ g_value_unset (&value);
+
+ ephy_history_visited (eb, bm);
+
+ ephy_node_add_child (host, bm);
+ ephy_node_add_child (eb->priv->pages, bm);
+}
+
+EphyNode *
+ephy_history_get_page (EphyHistory *eb,
+ const char *url)
+{
+ EphyNode *node;
+
+ g_static_rw_lock_reader_lock (eb->priv->pages_hash_lock);
+ node = g_hash_table_lookup (eb->priv->pages_hash, url);
+ g_static_rw_lock_reader_unlock (eb->priv->pages_hash_lock);
+
+ return node;
+}
+
+gboolean
+ephy_history_is_page_visited (EphyHistory *gh,
+ const char *url)
+{
+ return (ephy_history_get_page (gh, url) != NULL);
+}
+
+void
+ephy_history_set_page_title (EphyHistory *gh,
+ const char *url,
+ const char *title)
+{
+ EphyNode *node;
+
+ node = ephy_history_get_page (gh, url);
+ if (node)
+ {
+ GValue value = { 0, };
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, title);
+ ephy_node_set_property
+ (node, EPHY_NODE_PAGE_PROP_TITLE, &value);
+ g_value_unset (&value);
+ }
+}
+
+void
+ephy_history_clear (EphyHistory *gh)
+{
+ ephy_node_unref (gh->priv->hosts);
+ ephy_history_save (gh);
+}
+
+EphyNode *
+ephy_history_get_hosts (EphyHistory *eb)
+{
+ return eb->priv->hosts;
+}
+
+EphyNode *
+ephy_history_get_pages (EphyHistory *eb)
+{
+ return eb->priv->pages;
+}
+
+const char *
+ephy_history_get_last_page (EphyHistory *gh)
+{
+ if (gh->priv->last_page == NULL) return NULL;
+
+ return ephy_node_get_property_string
+ (gh->priv->last_page, EPHY_NODE_PAGE_PROP_LOCATION);
+}
diff --git a/embed/ephy-history.h b/embed/ephy-history.h
new file mode 100644
index 000000000..641ab6d7c
--- /dev/null
+++ b/embed/ephy-history.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_HISTORY_H
+#define EPHY_HISTORY_H
+
+#include <glib-object.h>
+
+#include "ephy-node.h"
+
+G_BEGIN_DECLS
+
+typedef struct EphyHistoryClass EphyHistoryClass;
+
+#define EPHY_HISTORY_TYPE (ephy_history_get_type ())
+#define EPHY_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_HISTORY_TYPE, EphyHistory))
+#define EPHY_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_HISTORY_TYPE, EphyHistoryClass))
+#define IS_EPHY_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_HISTORY_TYPE))
+#define IS_EPHY_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_HISTORY_TYPE))
+
+typedef struct EphyHistory EphyHistory;
+typedef struct EphyHistoryPrivate EphyHistoryPrivate;
+
+enum
+{
+ EPHY_NODE_PAGE_PROP_TITLE = 2,
+ EPHY_NODE_PAGE_PROP_LOCATION = 3,
+ EPHY_NODE_PAGE_PROP_VISITS = 4,
+ EPHY_NODE_PAGE_PROP_LAST_VISIT = 5,
+ EPHY_NODE_PAGE_PROP_FIRST_VISIT = 6,
+ EPHY_NODE_PAGE_PROP_HOST_ID = 7
+};
+
+struct EphyHistory
+{
+ GObject parent;
+ EphyHistoryPrivate *priv;
+};
+
+struct EphyHistoryClass
+{
+ GObjectClass parent_class;
+
+ void (* visited) (const char *url);
+};
+
+GType ephy_history_get_type (void);
+
+EphyHistory *ephy_history_new (void);
+
+EphyNode *ephy_history_get_hosts (EphyHistory *gh);
+
+EphyNode *ephy_history_get_pages (EphyHistory *gh);
+
+EphyNode *ephy_history_get_page (EphyHistory *gh,
+ const char *url);
+
+void ephy_history_add_page (EphyHistory *gh,
+ const char *url);
+
+gboolean ephy_history_is_page_visited (EphyHistory *gh,
+ const char *url);
+
+int ephy_history_get_page_visits (EphyHistory *gh,
+ const char *url);
+
+void ephy_history_set_page_title (EphyHistory *gh,
+ const char *url,
+ const char *title);
+
+const char *ephy_history_get_last_page (EphyHistory *gh);
+
+void ephy_history_clear (EphyHistory *gh);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/find-dialog.c b/embed/find-dialog.c
new file mode 100755
index 000000000..7b96e86c1
--- /dev/null
+++ b/embed/find-dialog.c
@@ -0,0 +1,431 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "find-dialog.h"
+#include "ephy-prefs.h"
+#include "ephy-embed.h"
+
+#define CONF_FIND_MATCH_CASE "/apps/epiphany/find/match_case"
+#define CONF_FIND_AUTOWRAP "/apps/epiphany/find/autowrap"
+#define CONF_FIND_WORD "/apps/epiphany/find/word"
+
+static void find_dialog_class_init (FindDialogClass *klass);
+static void find_dialog_init (FindDialog *dialog);
+static void find_dialog_finalize (GObject *object);
+
+static void
+impl_construct (EphyDialog *dialog,
+ const EphyDialogProperty *properties,
+ const char *file,
+ const char *name);
+static void
+impl_destruct (EphyDialog *dialog);
+static void
+impl_show (EphyDialog *dialog);
+
+
+/* Glade callbacks */
+void find_close_button_clicked_cb (GtkWidget *button, EphyDialog *dialog);
+void find_next_button_clicked_cb (GtkWidget *button, EphyDialog *dialog);
+void find_prev_button_clicked_cb (GtkWidget *button, EphyDialog *dialog);
+void find_entry_activate_cb (GtkWidget *editable, EphyDialog *dialog);
+void find_entry_changed_cb (GtkWidget *editable, EphyDialog *dialog);
+void find_check_toggled_cb (GtkWidget *toggle, EphyDialog *dialog);
+
+static GObjectClass *parent_class = NULL;
+
+struct FindDialogPrivate
+{
+ EmbedFindInfo *properties;
+ gboolean can_go_prev;
+ gboolean can_go_next;
+ gboolean constructed;
+};
+
+enum
+{
+ SEARCH,
+ LAST_SIGNAL
+};
+
+enum
+{
+ MATCH_CASE_PROP,
+ AUTOWRAP_PROP,
+ WORD_PROP,
+ BACK_BUTTON,
+ FORWARD_BUTTON
+};
+
+static const
+EphyDialogProperty properties [] =
+{
+ { MATCH_CASE_PROP, "case_check", CONF_FIND_MATCH_CASE, PT_NORMAL, NULL },
+ { AUTOWRAP_PROP, "wrap_check", CONF_FIND_AUTOWRAP, PT_NORMAL, NULL },
+ { WORD_PROP, "find_entry", CONF_FIND_WORD, PT_NORMAL, NULL },
+ { BACK_BUTTON, "back_button", NULL, PT_NORMAL, NULL },
+ { FORWARD_BUTTON, "forward_button", NULL, PT_NORMAL, NULL },
+ { -1, NULL, NULL }
+};
+
+static guint find_dialog_signals[LAST_SIGNAL] = { 0 };
+
+GType
+find_dialog_get_type (void)
+{
+ static GType find_dialog_type = 0;
+
+ if (find_dialog_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (FindDialogClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) find_dialog_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (FindDialog),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) find_dialog_init
+ };
+
+ find_dialog_type = g_type_register_static (EPHY_EMBED_DIALOG_TYPE,
+ "FindDialog",
+ &our_info, 0);
+ }
+
+ return find_dialog_type;
+
+}
+
+static void
+find_dialog_class_init (FindDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EphyDialogClass *ephy_dialog_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ ephy_dialog_class = EPHY_DIALOG_CLASS (klass);
+
+ object_class->finalize = find_dialog_finalize;
+
+ ephy_dialog_class->construct = impl_construct;
+ ephy_dialog_class->destruct = impl_destruct;
+ ephy_dialog_class->show = impl_show;
+
+ find_dialog_signals[SEARCH] =
+ g_signal_new ("search",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (FindDialogClass, search),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+static void
+find_update_nav (EphyDialog *dialog)
+{
+ GtkWidget *forward_button;
+ GtkWidget *back_button;
+
+ g_signal_emit (G_OBJECT (dialog), find_dialog_signals[SEARCH], 0);
+
+ if (!FIND_DIALOG(dialog)->priv->constructed) return;
+
+ forward_button = ephy_dialog_get_control (dialog, FORWARD_BUTTON);
+ gtk_widget_set_sensitive (forward_button,
+ FIND_DIALOG(dialog)->priv->can_go_next);
+
+ back_button = ephy_dialog_get_control (dialog, BACK_BUTTON);
+ gtk_widget_set_sensitive (back_button,
+ FIND_DIALOG(dialog)->priv->can_go_prev);
+}
+
+void static
+ensure_constructed (FindDialog *dialog)
+{
+ if (!dialog->priv->constructed)
+ {
+ ephy_dialog_construct (EPHY_DIALOG(dialog),
+ properties,
+ "epiphany.glade",
+ "find_dialog");
+ }
+}
+
+static void
+find_dialog_init (FindDialog *dialog)
+{
+ dialog->priv = g_new0 (FindDialogPrivate, 1);
+
+ dialog->priv->properties = NULL;
+ dialog->priv->can_go_prev = TRUE;
+ dialog->priv->can_go_next = TRUE;
+ dialog->priv->constructed = FALSE;
+
+ ensure_constructed (dialog);
+}
+
+static void
+impl_construct (EphyDialog *dialog,
+ const EphyDialogProperty *properties,
+ const char *file,
+ const char *name)
+{
+ FIND_DIALOG(dialog)->priv->constructed = TRUE;
+
+ EPHY_DIALOG_CLASS (parent_class)->construct (dialog, properties, file, name);
+}
+
+static void
+impl_destruct (EphyDialog *dialog)
+{
+ FIND_DIALOG(dialog)->priv->constructed = FALSE;
+
+ EPHY_DIALOG_CLASS (parent_class)->destruct (dialog);
+}
+
+static void
+impl_show (EphyDialog *dialog)
+{
+ FindDialog *find_dialog = FIND_DIALOG(dialog);
+ ensure_constructed (find_dialog);
+
+ find_dialog->priv->can_go_prev = TRUE;
+ find_dialog->priv->can_go_next = TRUE;
+ find_update_nav (dialog);
+
+ /* Focus the text entry. This will correctly select or leave
+ * unselected the existing text in the entry depending on the
+ * 'gtk-entry-select-on-focus = 0 / 1' setting in user's gtkrc.
+ */
+ gtk_widget_grab_focus (ephy_dialog_get_control (dialog, WORD_PROP));
+
+ EPHY_DIALOG_CLASS (parent_class)->show (dialog);
+}
+
+static void
+find_dialog_finalize (GObject *object)
+{
+ FindDialog *dialog;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_FIND_DIALOG (object));
+
+ dialog = FIND_DIALOG (object);
+
+ g_return_if_fail (dialog->priv != NULL);
+
+ g_free (dialog->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+EphyDialog *
+find_dialog_new (EphyEmbed *embed)
+{
+ FindDialog *dialog;
+
+ dialog = FIND_DIALOG (g_object_new (FIND_DIALOG_TYPE,
+ "EphyEmbed", embed,
+ NULL));
+
+ return EPHY_DIALOG(dialog);
+}
+
+EphyDialog *
+find_dialog_new_with_parent (GtkWidget *window,
+ EphyEmbed *embed)
+{
+ FindDialog *dialog;
+
+ dialog = FIND_DIALOG (g_object_new (FIND_DIALOG_TYPE,
+ "EphyEmbed", embed,
+ "ParentWindow", window,
+ NULL));
+
+ return EPHY_DIALOG(dialog);
+}
+
+gboolean
+find_dialog_can_go_next (FindDialog *dialog)
+{
+ return dialog->priv->can_go_next;
+}
+
+gboolean
+find_dialog_can_go_prev (FindDialog *dialog)
+{
+ return dialog->priv->can_go_prev;
+}
+
+void
+find_dialog_go_next (FindDialog *dialog,
+ gboolean interactive)
+{
+ gresult result;
+ EphyEmbed *embed;
+
+ if (!find_dialog_can_go_next (dialog)) return;
+
+ dialog->priv->properties->backwards = FALSE;
+ dialog->priv->properties->interactive = interactive;
+
+ embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG(dialog));
+ g_return_if_fail (embed != NULL);
+
+ result = ephy_embed_find (embed,
+ dialog->priv->properties);
+
+ dialog->priv->can_go_prev = TRUE;
+ if (result != G_OK)
+ {
+ dialog->priv->can_go_next = FALSE;
+ }
+
+ find_update_nav (EPHY_DIALOG(dialog));
+}
+
+void
+find_dialog_go_prev (FindDialog *dialog,
+ gboolean interactive)
+{
+ gresult result;
+ EphyEmbed *embed;
+
+ if (!find_dialog_can_go_prev (dialog)) return;
+
+ dialog->priv->properties->backwards = TRUE;
+ dialog->priv->properties->interactive = interactive;
+
+ embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG(dialog));
+ g_return_if_fail (embed != NULL);
+
+ result = ephy_embed_find (embed,
+ dialog->priv->properties);
+
+ dialog->priv->can_go_next = TRUE;
+ if (result != G_OK)
+ {
+ dialog->priv->can_go_prev = FALSE;
+ }
+
+ find_update_nav (EPHY_DIALOG(dialog));
+}
+
+static void
+find_get_info (EphyDialog *dialog)
+{
+ EmbedFindInfo *properties;
+ char *search_string;
+ GValue word = {0, };
+ GValue match_case = {0, };
+ GValue wrap = {0, };
+ FindDialog *find_dialog = FIND_DIALOG(dialog);
+
+ /* get the search string from the entry field */
+ ephy_dialog_get_value (dialog, WORD_PROP, &word);
+ search_string = g_strdup(g_value_get_string (&word));
+
+ /* don't do null searches */
+ if (search_string[0] == '\0')
+ {
+ return;
+ }
+
+ if (find_dialog->priv->properties != NULL)
+ {
+ g_free (find_dialog->priv->properties->search_string);
+ g_free (find_dialog->priv->properties);
+ }
+
+ /* build search structure */
+ properties = g_new0 (EmbedFindInfo,1);
+ properties->search_string = search_string;
+
+ ephy_dialog_get_value (dialog, MATCH_CASE_PROP, &match_case);
+ properties->match_case = g_value_get_boolean (&match_case);
+
+ ephy_dialog_get_value (dialog, AUTOWRAP_PROP, &wrap);
+ properties->wrap = g_value_get_boolean (&wrap);
+
+ properties->entire_word = FALSE;
+ properties->search_frames = TRUE;
+
+ find_dialog->priv->properties = properties;
+}
+
+void
+find_close_button_clicked_cb (GtkWidget *button,
+ EphyDialog *dialog)
+{
+ ephy_dialog_destruct (dialog);
+ g_object_unref (dialog);
+}
+
+void find_next_button_clicked_cb (GtkWidget *button,
+ EphyDialog *dialog)
+{
+ find_dialog_go_next (FIND_DIALOG(dialog), TRUE);
+}
+
+void
+find_prev_button_clicked_cb (GtkWidget *button,
+ EphyDialog *dialog)
+{
+ find_dialog_go_prev (FIND_DIALOG(dialog), TRUE);
+}
+
+void
+find_entry_activate_cb (GtkWidget *editable,
+ EphyDialog *dialog)
+{
+ find_dialog_go_next (FIND_DIALOG(dialog), TRUE);
+ find_update_nav (dialog);
+}
+
+void
+find_entry_changed_cb (GtkWidget *editable,
+ EphyDialog *dialog)
+{
+ FindDialog *find_dialog = FIND_DIALOG(dialog);
+
+ find_dialog->priv->can_go_prev = TRUE;
+ find_dialog->priv->can_go_next = TRUE;
+
+ find_get_info (dialog);
+
+ find_update_nav (dialog);
+}
+
+void
+find_check_toggled_cb (GtkWidget *toggle,
+ EphyDialog *dialog)
+{
+ FindDialog *find_dialog = FIND_DIALOG(dialog);
+
+ find_dialog->priv->can_go_prev = TRUE;
+ find_dialog->priv->can_go_next = TRUE;
+
+ find_get_info (dialog);
+
+ find_update_nav (dialog);
+}
diff --git a/embed/find-dialog.h b/embed/find-dialog.h
new file mode 100644
index 000000000..325f8a7b7
--- /dev/null
+++ b/embed/find-dialog.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef FIND_DIALOG_H
+#define FIND_DIALOG_H
+
+#include "ephy-embed-dialog.h"
+
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct FindDialog FindDialog;
+typedef struct FindDialogClass FindDialogClass;
+
+#define FIND_DIALOG_TYPE (find_dialog_get_type ())
+#define FIND_DIALOG(obj) (GTK_CHECK_CAST ((obj), FIND_DIALOG_TYPE, FindDialog))
+#define FIND_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), FIND_DIALOG, FindDialogClass))
+#define IS_FIND_DIALOG(obj) (GTK_CHECK_TYPE ((obj), FIND_DIALOG_TYPE))
+#define IS_FIND_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FIND_DIALOG))
+
+typedef struct FindDialogPrivate FindDialogPrivate;
+
+struct FindDialog
+{
+ EphyEmbedDialog parent;
+ FindDialogPrivate *priv;
+};
+
+struct FindDialogClass
+{
+ EphyEmbedDialogClass parent_class;
+
+ void (* search) (FindDialog *dialog);
+};
+
+GType find_dialog_get_type (void);
+
+EphyDialog *find_dialog_new (EphyEmbed *embed);
+
+EphyDialog *find_dialog_new_with_parent (GtkWidget *window,
+ EphyEmbed *embed);
+
+
+gboolean find_dialog_can_go_next (FindDialog *dialog);
+
+gboolean find_dialog_can_go_prev (FindDialog *dialog);
+
+void find_dialog_go_next (FindDialog *dialog,
+ gboolean interactive);
+
+void find_dialog_go_prev (FindDialog *dialog,
+ gboolean interactive);
+
+G_END_DECLS
+
+#endif
+
diff --git a/embed/mozilla/.cvsignore b/embed/mozilla/.cvsignore
new file mode 100644
index 000000000..20e4cb0c8
--- /dev/null
+++ b/embed/mozilla/.cvsignore
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+*.lo
+.deps
+.libs
+*.la
diff --git a/embed/mozilla/BaseProtocolContentHandler.cpp b/embed/mozilla/BaseProtocolContentHandler.cpp
new file mode 100644
index 000000000..741d21722
--- /dev/null
+++ b/embed/mozilla/BaseProtocolContentHandler.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "nsCOMPtr.h"
+#include "nsIURI.h"
+#include "nsIChannel.h"
+#include "nsIStorageStream.h"
+#include "nsIInputStream.h"
+#include "nsIOutputStream.h"
+#include "nsNetUtil.h"
+#include "nsIExternalProtocolService.h"
+#include "nsCExternalHandlerService.h"
+
+#include "BaseProtocolContentHandler.h"
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS2 (GBaseProtocolContentHandler, nsIProtocolHandler, nsIContentHandler)
+
+GBaseProtocolContentHandler::GBaseProtocolContentHandler(const char *aScheme) :
+ GBaseProtocolHandler(aScheme)
+{
+ NS_INIT_ISUPPORTS();
+ /* member initializers and constructor code */
+ mMimeType = NS_LITERAL_CSTRING("application-x-gnome-") + mScheme;
+}
+
+GBaseProtocolContentHandler::~GBaseProtocolContentHandler()
+{
+ /* destructor code */
+}
+
+/* nsIChannel newChannel (in nsIURI aURI); */
+NS_IMETHODIMP GBaseProtocolContentHandler::NewChannel(nsIURI *aURI,
+ nsIChannel **_retval)
+{
+ nsCOMPtr<nsIStorageStream> sStream;
+ nsresult rv = NS_NewStorageStream(1, 16, getter_AddRefs(sStream));
+ if (NS_FAILED(rv)) return rv;
+
+ nsCOMPtr<nsIOutputStream> oStream;
+ rv = sStream->GetOutputStream(0, getter_AddRefs(oStream));
+
+ PRUint32 bytes;
+ oStream->Write("Dummy stream\0", 13, &bytes);
+
+ nsCOMPtr<nsIInputStream> iStream;
+ rv = sStream->NewInputStream(0, getter_AddRefs(iStream));
+ if (NS_FAILED(rv)) return rv;
+
+ nsCOMPtr<nsIChannel> channel;
+ rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI,
+ iStream, mMimeType, NS_LITERAL_CSTRING(""), 0);
+ if (NS_FAILED(rv)) return rv;
+
+ NS_IF_ADDREF (*_retval = channel);
+ return rv;
+}
+
+NS_IMETHODIMP GBaseProtocolContentHandler::HandleContent (
+ const char * aContentType,
+ const char * aCommand,
+ nsISupports * aWindowContext,
+ nsIRequest *aRequest)
+{
+ nsresult rv = NS_OK;
+ if (!aRequest)
+ return NS_ERROR_NULL_POINTER;
+ // First of all, get the content type and make sure it is a
+ // content type we know how to handle!
+ if (mMimeType.Equals(aContentType))
+ {
+ nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
+ if(!channel) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ rv = channel->GetURI(getter_AddRefs(uri));
+ if (NS_FAILED(rv)) return rv;
+
+ aRequest->Cancel(NS_BINDING_ABORTED);
+ if (uri)
+ {
+ nsCOMPtr<nsIExternalProtocolService> ps =
+ do_GetService (NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &rv);
+ if (NS_FAILED(rv) || !ps) return NS_ERROR_FAILURE;
+ ps->LoadUrl (uri);
+ }
+ }
+ return rv;
+}
diff --git a/embed/mozilla/BaseProtocolContentHandler.h b/embed/mozilla/BaseProtocolContentHandler.h
new file mode 100644
index 000000000..b1f5c1e71
--- /dev/null
+++ b/embed/mozilla/BaseProtocolContentHandler.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _BaseProtocolContentHandler_h_
+#define _BaseProtocolContentHandler_h_
+
+#include "BaseProtocolHandler.h"
+#include "nsIContentHandler.h"
+
+#include "nsString.h"
+
+class GBaseProtocolContentHandler : public GBaseProtocolHandler,
+ public nsIContentHandler
+{
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSICONTENTHANDLER
+
+ NS_IMETHODIMP NewChannel(nsIURI *aURI, nsIChannel **_retval);
+
+ GBaseProtocolContentHandler (const char *aScheme);
+ virtual ~GBaseProtocolContentHandler();
+ /* additional members */
+ protected:
+ nsCString mMimeType;
+};
+
+#endif //_BaseProtocolContentHandler_h_
diff --git a/embed/mozilla/BaseProtocolHandler.cpp b/embed/mozilla/BaseProtocolHandler.cpp
new file mode 100644
index 000000000..728465a15
--- /dev/null
+++ b/embed/mozilla/BaseProtocolHandler.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "nsCOMPtr.h"
+#include "nsIComponentManager.h"
+#include "nsIURI.h"
+#include "nsNetCID.h"
+
+#include "BaseProtocolHandler.h"
+
+static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1 (GBaseProtocolHandler, nsIProtocolHandler)
+
+GBaseProtocolHandler::GBaseProtocolHandler(const char *aScheme)
+{
+ NS_INIT_ISUPPORTS();
+ /* member initializers and constructor code */
+ mScheme.Assign(aScheme);
+}
+
+GBaseProtocolHandler::~GBaseProtocolHandler()
+{
+ /* destructor code */
+}
+
+/* readonly attribute string scheme; */
+NS_IMETHODIMP GBaseProtocolHandler::GetScheme(nsACString &aScheme)
+{
+ aScheme = mScheme;
+ return NS_OK;
+}
+
+/* readonly attribute long defaultPort; */
+NS_IMETHODIMP GBaseProtocolHandler::GetDefaultPort(PRInt32 *aDefaultPort)
+{
+ if (aDefaultPort)
+ *aDefaultPort = -1;
+ else
+ return NS_ERROR_NULL_POINTER;
+ return NS_OK;
+}
+
+/* readonly attribute short protocolFlags; */
+NS_IMETHODIMP GBaseProtocolHandler::GetProtocolFlags(PRUint32 *aProtocolFlags)
+{
+ if (aProtocolFlags)
+ *aProtocolFlags = nsIProtocolHandler::URI_STD;
+ else
+ return NS_ERROR_NULL_POINTER;
+ return NS_OK;
+}
+
+/* nsIURI newURI (in string aSpec, in nsIURI aBaseURI); */
+NS_IMETHODIMP GBaseProtocolHandler::NewURI(const nsACString &aSpec,
+ const char *aOriginCharset, nsIURI *aBaseURI,
+ nsIURI **_retval)
+{
+ nsresult rv = NS_OK;
+ nsCOMPtr <nsIURI> newUri;
+
+ rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
+ NS_GET_IID(nsIURI),
+ getter_AddRefs(newUri));
+
+ if (NS_SUCCEEDED(rv))
+ {
+ newUri->SetSpec(aSpec);
+ rv = newUri->QueryInterface(NS_GET_IID(nsIURI),
+ (void **) _retval);
+ }
+ return rv;
+
+}
+
+/* nsIChannel newChannel (in nsIURI aURI); */
+NS_IMETHODIMP GBaseProtocolHandler::NewChannel(nsIURI *aURI,
+ nsIChannel **_retval)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* boolean allowPort (in long port, in string scheme); */
+NS_IMETHODIMP GBaseProtocolHandler::AllowPort(PRInt32 port, const char *scheme,
+ PRBool *_retval)
+{
+ *_retval = PR_FALSE;
+ return NS_OK;
+}
+
diff --git a/embed/mozilla/BaseProtocolHandler.h b/embed/mozilla/BaseProtocolHandler.h
new file mode 100644
index 000000000..ab25a680d
--- /dev/null
+++ b/embed/mozilla/BaseProtocolHandler.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _BaseProtocolHandler_h_
+#define _BaseProtocolHandler_h_
+
+#include "nsIProtocolHandler.h"
+
+#include "nsString.h"
+
+class GBaseProtocolHandler : public nsIProtocolHandler
+{
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIPROTOCOLHANDLER
+
+ GBaseProtocolHandler (const char *aScheme);
+ virtual ~GBaseProtocolHandler();
+ /* additional members */
+ protected:
+ nsCString mScheme;
+};
+
+#endif //_BaseProtocolHandler_h_
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
new file mode 100644
index 000000000..9476a2f72
--- /dev/null
+++ b/embed/mozilla/ContentHandler.cpp
@@ -0,0 +1,671 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * The functioning of the download architecture, as described by Philip
+ * on 28 May 2001 and updated on 28 June 2001:
+ *
+ * When mozilla runs into a file it cannot render internally or that it
+ * does not have a plugin for, it calls the
+ * nsIExternalHelperAppService. This service will then either attempt to
+ * save the file or run it with a helper app depending on what the
+ * mozilla mime database returns.
+ *
+ * nsIExternalHelperAppService then calls out to the nsIHelperAppDialog
+ * interface which handles the UI for the service. This is the interface
+ * which we have reimplemented. Therefore, with a major caveat, we have
+ * put a GNOME/GTK frontend on an unmodified mozilla backend.
+ *
+ * Now for the caveat. With respect to saving files to disk, the mozilla
+ * backend works exactly the same as it does in
+ * mozilla-the-browser. However, for dealing with helper apps, we do not
+ * use the mozilla backend at all. This is because we want to use the
+ * gnome-vfs database to retrieve helper-app info, rather than the
+ * mozilla helper app database.
+ *
+ * How it works:
+ *
+ * a) The user clicks on a link or follows a redirect to a file of a type
+ * that mozilla cannot handle. Mozilla passes the link to the
+ * ExternalHelperAppService which in turn calls the Show() method of
+ * nsIHelperAppDialog.
+ *
+ * b) In our implementation of Show() we first compare the passed mime
+ * type to epiphany's mime list. If the mime type is in the list, we then
+ * lookup the Action associated with the mime type. Currently, the
+ * possible mime-actions are:
+ *
+ * Save to Disk
+ * Run with Helper App
+ * Ask User
+ *
+ * The default action is Ask User, and if the mime-type is not in our
+ * list, this is what will be assumed.
+ *
+ * c) If Ask User is the chosen action, a dialog will be shown to the
+ * user allowing the user to choose from the other two possible actions
+ * as well as a checkbox to let the user set the default action to the
+ * chosen action for the future.
+ *
+ * d-1) The "Save to Disk" action. We first check epiphany preferences to
+ * see if the user wants to use the built-in mozilla downloader, gtm or
+ * a command-line executed downloader.
+ *
+ * d-2a) The built-in downloader. This action is handled by the mozilla
+ * backend. Our nsIHelperAppDialog does the same thing that the
+ * mozilla-the-browser one does, which is to call the SaveToDisk() method
+ * of nsIExternalHelperAppService. This in turn calls the
+ * PromptForSaveToFile() method of nsIHelperAppDialog putting the ball
+ * back in our court.
+ *
+ * d-2b) Now, if epiphany is configured to always ask for a download
+ * directory, it will pop up a file selector so that the user can select
+ * the directory and filename to save the file to. Otherwise, it will
+ * use epiphany's default download directory and proceed without
+ * interaction.
+ *
+ * d-2c) When PromptForSaveToFile() returns, nsIExternalHelperAppService
+ * will then call the ShowProgressDialog() method of
+ * nsIHelperAppDialog. This progress dialog, obviously, tracks the
+ * progress of the download. It is worth noting that mozilla starts the
+ * actual download as soon as the user clicks on the link or follows the
+ * redirect. While the user is deciding what action to take, the file is
+ * downloading. Often, for small files, the file is already downloaded
+ * when the user decides what directory to put it in. The progress dialog
+ * does not appear in these cases. Also, we currently have a small
+ * problem where our progress dialog times the download from the point
+ * the dialog appears, not from the time the download starts. This is due
+ * to the timestamp that is passed to us is just plain weird, and I
+ * haven't worked out how to turn it into a useable time. The fact that
+ * the download starts early means that the file is actually downloaded
+ * to a temp file and only at the end is it moved to it's final location.
+ *
+ * d-3a) The two external downloader options. These options are
+ * handled completely by epiphany. The first thing that we do is call the
+ * Cancel() method of nsIExternalHelperAppService to cancel the mozilla
+ * download. We then pass the url to our own LaunchExternalDownloader()
+ * method. This method will ask for a download directory as appropriate
+ * as with the "Save to disk" action.
+ *
+ * d-3b) Finally, depending on whether GTM or a command line handler was
+ * selected in prefs, the external handler will be called with the url
+ * passed and the directory selected.
+ *
+ * e-1) The "Run with Helper App" action. This action is currently only
+ * working with a minimal implementation. First, we explicitly call
+ * ShowProgressDialog() so the user knows that the file is being
+ * downloaded. We also need this so that we only run the helper after the
+ * file is completely downloaded. The file will download to temp location
+ * that it would be moved from if the action was "Save to Disk". We have
+ * to call ShowProgressDialog() ourselves because we are not using
+ * mozilla's helper mechanism which would usually make the call for us.
+ *
+ * e-2) If there is a default helper app in our mime database and alwaysAsk
+ * is false, epiphany will run the default helper automatically. Otherwise it
+ * will pop up a helper chooser dialog which lists the helpers that gnome-vfs
+ * knows about as well as providing a GnomeFileEntry to allow the user to
+ * select and arbitrary application. The default value of the GnomeFileEntry
+ * is the helper stored in our database if one exits.
+ *
+ * f) General notes. We cannot use this infrastructure to override
+ * native mozilla types. mozilla will attempt to render these types and
+ * never call out to us. We are at the end of the chain as the handler of
+ * last resort, so native and plugin types will never reach us. This also
+ * means that a file with an incorrect mime-type ( eg: .tar.bz2 marked as
+ * text/plain ) will be incorrectly rendered by mozilla. We cannot help
+ * this.
+ *
+ * Despite the apparent user-side similarity with explicit downloads by
+ * a shift-click or context-menu item, there is actually none at all.
+ * Explicit downloads are handled by the nsIStreamTransfer manager which
+ * we use as is. Currently the progress dialog for the stream transfer
+ * manager is un-overridable, so it appears in XUL. This will change in
+ * due course.
+ *
+ * Matt would like the modifiy the progress dialog so each file currently
+ * being downloaded becomes a clist entry in a master dialog rather than
+ * causing a separate progress dialog. a lot of progress dialogs gets
+ * really messy.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+extern "C" {
+#include "libgnomevfs/gnome-vfs-mime-handlers.h"
+}
+
+#include "ephy-embed-shell.h"
+#include "ephy-prefs.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-glade.h"
+#include "ephy-string.h"
+#include "ephy-gui.h"
+#include "ephy-embed-utils.h"
+#include "ephy-file-helpers.h"
+#include "ProgressListener.h"
+#include "ContentHandler.h"
+
+#include <gtk/gtkentry.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkprogress.h>
+#include <gtk/gtkoptionmenu.h>
+#include <libgnome/gnome-exec.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-config.h>
+#include <libgnome/gnome-util.h>
+#include <libgnomevfs/gnome-vfs-mime.h>
+
+#include "FilePicker.h"
+#include "MozillaPrivate.h"
+
+#include "nsCRT.h"
+#include "nsCOMPtr.h"
+#include "nsIFactory.h"
+#include "nsISupportsArray.h"
+#include "nsIServiceManager.h"
+#include "nsWeakReference.h"
+#include "nsXPComFactory.h"
+
+#include "nsString.h"
+#include "nsIURI.h"
+#include "nsIURL.h"
+#include "nsIMIMEInfo.h"
+#include "nsIChannel.h"
+#include "nsIFTPChannel.h"
+#include "nsILocalFile.h"
+#include "nsIPrefService.h"
+#include "nsIDOMWindow.h"
+#include "nsIDOMWindowInternal.h"
+
+class GContentHandler;
+class GDownloadProgressListener;
+struct MimeAskActionDialog;
+struct HelperAppChooserDialog;
+
+extern "C"
+void mime_ask_dialog_save_clicked_cb (GtkButton *button,
+ MimeAskActionDialog *dialog);
+extern "C"
+void mime_ask_dialog_open_clicked_cb (GtkButton *button,
+ MimeAskActionDialog *dialog);
+extern "C"
+gint mime_ask_dialog_cancel_clicked_cb (GtkButton *button,
+ MimeAskActionDialog *dialog);
+
+/*
+ * MimeAskActionDialog: the representation of dialogs used to ask
+ * about actions on MIME types
+ */
+struct MimeAskActionDialog
+{
+ MimeAskActionDialog(GContentHandler *aContentHandler,
+ GtkWidget *aParentWidget,
+ const char *aMimeType);
+ ~MimeAskActionDialog();
+
+ GContentHandler *mContentHandler;
+ GladeXML *mGXml;
+ GtkWidget *mParent;
+ GtkWidget *mAppMenu;
+
+ GnomeVFSMimeApplication *mDefaultApp;
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1(GContentHandler, nsIHelperAppLauncherDialog)
+
+GContentHandler::GContentHandler() : mUri(nsnull),
+ mMimeType(nsnull),
+ mDownloadCanceled(PR_FALSE),
+ mHelperProgress(PR_FALSE)
+{
+ NS_INIT_ISUPPORTS();
+ /* member initializers and constructor code */
+}
+
+GContentHandler::~GContentHandler()
+{
+ /* destructor code */
+ g_free (mUri);
+ g_free (mMimeType);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin nsIHelperAppLauncher impl
+////////////////////////////////////////////////////////////////////////////////
+
+/* void show (in nsIHelperAppLauncher aLauncher, in nsISupports aContext); */
+NS_IMETHODIMP GContentHandler::Show(nsIHelperAppLauncher *aLauncher,
+ nsISupports *aContext)
+{
+ nsresult rv;
+
+ mLauncher = aLauncher;
+ mContext = aContext;
+ rv = Init ();
+
+ MIMEAskAction ();
+
+ return NS_OK;
+}
+
+/* nsILocalFile promptForSaveToFile (in nsISupports aWindowContext, in wstring aDefaultFile, in wstring aSuggestedFileExtension); */
+NS_IMETHODIMP GContentHandler::
+ PromptForSaveToFile(nsISupports *aWindowContext,
+ const PRUnichar *aDefaultFile,
+ const PRUnichar *aSuggestedFileExtension,
+ nsILocalFile **_retval)
+{
+ nsresult rv;
+
+ mContext = aWindowContext;
+
+ nsCOMPtr<nsIDOMWindowInternal> windowInternal =
+ do_QueryInterface (aWindowContext);
+
+ nsCOMPtr<nsILocalFile> saveDir;
+ char *dirName;
+
+ /* FIXME persist download dir */
+ dirName = g_strdup (g_get_home_dir());
+
+ saveDir = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ saveDir->InitWithPath (NS_ConvertUTF8toUCS2(dirName));
+ g_free (dirName);
+
+ nsCOMPtr <nsILocalFile> saveFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+
+ PRInt16 okToSave = nsIFilePicker::returnCancel;
+
+ if (okToSave == nsIFilePicker::returnCancel)
+ {
+ nsCOMPtr<nsIFilePicker> filePicker =
+ do_CreateInstance (G_FILEPICKER_CONTRACTID);
+
+ const nsAString &title = NS_ConvertUTF8toUCS2(_("Select the destination filename"));
+
+ filePicker->Init (windowInternal,
+ PromiseFlatString(title).get(),
+ nsIFilePicker::modeSave);
+ filePicker->SetDefaultString (aDefaultFile);
+ filePicker->SetDisplayDirectory (saveDir);
+
+ filePicker->Show (&okToSave);
+
+ if (okToSave == nsIFilePicker::returnOK)
+ {
+ filePicker->GetFile (getter_AddRefs(saveFile));
+ }
+ }
+
+ if (okToSave == nsIFilePicker::returnCancel)
+ return NS_ERROR_FAILURE;
+ else
+ {
+ nsCOMPtr<nsIFile> directory;
+ rv = saveFile->GetParent (getter_AddRefs(directory));
+
+ NS_IF_ADDREF (*_retval = saveFile);
+ return NS_OK;
+ }
+}
+
+/* void showProgressDialog (in nsIHelperAppLauncher aLauncher, in nsISupports aContext); */
+NS_METHOD GContentHandler::ShowProgressDialog(nsIHelperAppLauncher *aLauncher,
+ nsISupports *aContext)
+{
+ g_print ("GContentHandler::ShowProgressDialog is depreciated!\n");
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin local public methods impl
+////////////////////////////////////////////////////////////////////////////////
+
+NS_METHOD GContentHandler::FindHelperApp (void)
+{
+ if (mUrlHelper)
+ {
+ return LaunchHelperApp ();
+ }
+ else
+ {
+ if (NS_SUCCEEDED(SynchroniseMIMEInfo()))
+ {
+ return mLauncher->LaunchWithApplication(nsnull, PR_FALSE);
+ }
+ else
+ {
+ return NS_ERROR_FAILURE;
+ }
+ }
+}
+
+NS_METHOD GContentHandler::LaunchHelperApp (void)
+{
+ if (mMimeType)
+ {
+ nsresult rv;
+ nsCOMPtr<nsIExternalHelperAppService> helperService =
+ do_GetService (NS_EXTERNALHELPERAPPSERVICE_CONTRACTID);
+
+ nsCOMPtr<nsPIExternalAppLauncher> appLauncher =
+ do_QueryInterface (helperService, &rv);
+ if (NS_SUCCEEDED(rv))
+ {
+ appLauncher->DeleteTemporaryFileOnExit(mTempFile);
+ }
+
+ nsString uFileName;
+ mTempFile->GetPath(uFileName);
+ const nsCString &aFileName = NS_ConvertUCS2toUTF8(uFileName);
+
+ const nsCString &document = (mUrlHelper) ? mUrl : aFileName;
+
+ char *param = g_strdup (document.get());
+ ephy_file_launch_application (mHelperApp->command,
+ param,
+ mHelperApp->requires_terminal);
+
+ if(mUrlHelper) mLauncher->Cancel();
+
+ g_free (param);
+ }
+ else
+ {
+ mLauncher->Cancel ();
+ }
+
+ return NS_OK;
+}
+
+NS_METHOD GContentHandler::ShowHelperProgressDialog (void)
+{
+ mHelperProgress = PR_TRUE;
+ return ShowProgressDialog (mLauncher,mContext);
+}
+
+NS_METHOD GContentHandler::GetLauncher (nsIHelperAppLauncher * *_retval)
+{
+ NS_IF_ADDREF (*_retval = mLauncher);
+ return NS_OK;
+}
+
+NS_METHOD GContentHandler::GetContext (nsISupports * *_retval)
+{
+ NS_IF_ADDREF (*_retval = mContext);
+ return NS_OK;
+}
+
+static gboolean
+application_support_scheme (GnomeVFSMimeApplication *app, const nsCString &aScheme)
+{
+ GList *l;
+
+ g_return_val_if_fail (app != NULL, FALSE);
+ g_return_val_if_fail (!aScheme.IsEmpty(), FALSE);
+
+ if (app->expects_uris != GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS)
+ return FALSE;
+
+ for (l = app->supported_uri_schemes; l != NULL; l = l->next)
+ {
+ char *uri_scheme = (char *)l->data;
+ g_return_val_if_fail (uri_scheme != NULL, FALSE);
+ if (aScheme.Equals(uri_scheme)) return TRUE;
+ }
+
+ return FALSE;
+}
+
+NS_METHOD GContentHandler::SetHelperApp(GnomeVFSMimeApplication *aHelperApp,
+ PRBool alwaysUse)
+{
+ mHelperApp = aHelperApp;
+ mUrlHelper = application_support_scheme (aHelperApp, mScheme);
+
+ return NS_OK;
+}
+
+NS_METHOD GContentHandler::SynchroniseMIMEInfo (void)
+{
+ nsresult rv;
+ nsCOMPtr<nsIMIMEInfo> mimeInfo;
+ rv = mLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo));
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsILocalFile> helperFile;
+ rv = NS_NewNativeLocalFile(nsDependentCString(mHelperApp->command),
+ PR_TRUE,
+ getter_AddRefs(helperFile));
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ rv = mimeInfo->SetPreferredApplicationHandler(helperFile);
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsMIMEInfoHandleAction mimeInfoAction;
+ mimeInfoAction = nsIMIMEInfo::alwaysAsk;
+
+ if(mHelperApp->requires_terminal) //Information passing kludge!
+ {
+ rv = mimeInfo->SetApplicationDescription
+ (NS_LITERAL_STRING("runInTerminal").get());
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+ }
+
+ rv = mimeInfo->SetPreferredAction(mimeInfoAction);
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ return NS_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin local private methods impl
+////////////////////////////////////////////////////////////////////////////////
+NS_METHOD GContentHandler::Init (void)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIMIMEInfo> MIMEInfo;
+ rv = mLauncher->GetMIMEInfo (getter_AddRefs(MIMEInfo));
+ rv = MIMEInfo->GetMIMEType (&mMimeType);
+
+ rv = mLauncher->GetDownloadInfo(getter_AddRefs(mUri),
+ &mTimeDownloadStarted,
+ getter_AddRefs(mTempFile));
+ rv = mUri->GetSpec (mUrl);
+ rv = mUri->GetScheme (mScheme);
+#if 0
+ /* GetSource seems redundant and isn't in 0.9 This code is here while
+ it remains unclear what GetSource is for. --phil */
+ nsCOMPtr<nsIURI> uri;
+ rv = mLauncher->GetSource(getter_AddRefs(uri));
+ rv = uri->GetSpec (mUrl);
+#endif
+ ProcessMimeInfo ();
+
+ return NS_OK;
+}
+
+NS_METHOD GContentHandler::ProcessMimeInfo (void)
+{
+ if (mMimeType == NULL ||
+ !nsCRT::strcmp(mMimeType, "application/octet-stream"))
+ {
+ nsresult rv;
+ nsCOMPtr<nsIURL> url = do_QueryInterface(mUri, &rv);
+ if (NS_SUCCEEDED(rv) && url)
+ {
+ nsCAutoString uriFileName;
+ url->GetFileName(uriFileName);
+ mMimeType = g_strdup
+ (gnome_vfs_mime_type_from_name
+ (uriFileName.get()));
+ }
+ else
+ mMimeType = g_strdup ("application/octet-stream");
+ }
+
+ return NS_OK;
+}
+
+NS_METHOD GContentHandler::MIMEAskAction (void)
+{
+ nsCOMPtr<nsIDOMWindow> parent = do_QueryInterface (mContext);
+ GtkWidget *parentWidget = MozillaFindGtkParent (parent);
+
+ new MimeAskActionDialog(this, parentWidget, mMimeType);
+
+ return NS_OK;
+}
+
+//------------------------------------------------------------------------------
+
+NS_DEF_FACTORY (GContentHandler, GContentHandler);
+
+/**
+ * NS_NewContentHandlerFactory:
+ */
+nsresult NS_NewContentHandlerFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGContentHandlerFactory *result = new nsGContentHandlerFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin MIMEAskActionDialog methods.
+////////////////////////////////////////////////////////////////////////////////
+
+MimeAskActionDialog::MimeAskActionDialog(GContentHandler *aContentHandler,
+ GtkWidget *aParentWidget,
+ const char *aMimeType) :
+ mContentHandler(aContentHandler),
+ mParent(aParentWidget)
+{
+ GtkWidget *label;
+ GtkWidget *dialogWidget;
+ const char *description;
+ char ltext[255]; //philipl: Fixed length buffer == potential security problem...
+
+ mGXml = ephy_glade_widget_new ("epiphany.glade", "mime_ask_action_dialog",
+ &dialogWidget, this);
+ mAppMenu = glade_xml_get_widget (mGXml, "mime_ask_dialog_app_menu");
+
+ mDefaultApp = gnome_vfs_mime_get_default_application(aMimeType);
+
+ GtkWidget *aMimeIcon = glade_xml_get_widget (mGXml,
+ "mime_ask_action_icon");
+ gtk_image_set_from_file(GTK_IMAGE(aMimeIcon),
+ gnome_vfs_mime_get_icon(aMimeType));
+
+ description = gnome_vfs_mime_get_description (aMimeType);
+ if (!description) description = aMimeType;
+
+ g_snprintf (ltext, 255, "<b>%s</b>", description);
+ label = glade_xml_get_widget (mGXml, "mime_ask_action_description");
+ gtk_label_set_markup (GTK_LABEL (label), ltext);
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialogWidget),
+ GTK_WINDOW (aParentWidget));
+
+ gtk_widget_show(dialogWidget);
+}
+
+MimeAskActionDialog::~MimeAskActionDialog()
+{
+#if 0
+ if(mApps)
+ gnome_vfs_mime_application_list_free(mApps);
+#endif
+
+ gtk_widget_destroy(glade_xml_get_widget(mGXml, "mime_ask_action_dialog"));
+ g_object_unref(G_OBJECT(mGXml));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin MIMEAskActionDialog callbacks.
+////////////////////////////////////////////////////////////////////////////////
+
+extern "C" void
+mime_ask_dialog_save_clicked_cb (GtkButton *button, MimeAskActionDialog *dialog)
+{
+ gtk_widget_hide (glade_xml_get_widget (dialog->mGXml,
+ "mime_ask_action_dialog"));
+
+ nsresult rv;
+ nsCOMPtr<nsIHelperAppLauncher> launcher;
+ rv = dialog->mContentHandler->GetLauncher (getter_AddRefs(launcher));
+
+ launcher->SaveToDisk (nsnull,PR_FALSE);
+
+ delete dialog;
+}
+
+static void
+mime_ask_dialog_download_cancel (MimeAskActionDialog *dialog)
+{
+ nsresult rv;
+ nsCOMPtr<nsIHelperAppLauncher> launcher;
+ rv = dialog->mContentHandler->GetLauncher (getter_AddRefs(launcher));
+
+ launcher->Cancel ();
+
+ delete dialog;
+}
+
+extern "C" void
+mime_ask_dialog_open_clicked_cb (GtkButton *button, MimeAskActionDialog *dialog)
+{
+ nsresult rv;
+ nsCOMPtr<nsIHelperAppLauncher> launcher;
+ rv = dialog->mContentHandler->GetLauncher (getter_AddRefs(launcher));
+ GnomeVFSMimeApplication *app = dialog->mDefaultApp;
+
+ if (app)
+ {
+ dialog->mContentHandler->SetHelperApp (app, FALSE);
+ dialog->mContentHandler->FindHelperApp ();
+ delete dialog;
+ }
+ else
+ {
+ mime_ask_dialog_download_cancel (dialog);
+ ephy_embed_utils_nohandler_dialog_run (dialog->mParent);
+ }
+}
+
+extern "C" gint
+mime_ask_dialog_cancel_clicked_cb (GtkButton *button,
+ MimeAskActionDialog *dialog)
+{
+ mime_ask_dialog_download_cancel (dialog);
+ return 0; /* FIXME: philipl, is this the right thing to return? */
+}
diff --git a/embed/mozilla/ContentHandler.h b/embed/mozilla/ContentHandler.h
new file mode 100644
index 000000000..6ae61f657
--- /dev/null
+++ b/embed/mozilla/ContentHandler.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __ContentHandler_h
+#define __ContentHandler_h
+
+#include "mozilla-embed-shell.h"
+
+#include <libgnomevfs/gnome-vfs-mime-handlers.h>
+#include "nsIHelperAppLauncherDialog.h"
+#include "nsIExternalHelperAppService.h"
+#include "nsCExternalHandlerService.h"
+#include "nsIWebProgressListener.h"
+
+#include "nsString.h"
+#include "nsIURI.h"
+#include "nsILocalFile.h"
+
+#include "nsCOMPtr.h"
+#include "nsISupports.h"
+#include "nsError.h"
+
+typedef enum
+{
+ ACTION_NONE,
+ ACTION_SAVEFORHELPER,
+ ACTION_OBJECT_NOTIFY
+} DownloadAction;
+
+#define G_CONTENTHANDLER_CID \
+{ /* 16072c4a-23a6-4996-9beb-9335c06bbeae */ \
+ 0x16072c4a, \
+ 0x23a6, \
+ 0x4996, \
+ {0x9b, 0xeb, 0x93, 0x35, 0xc0, 0x6b, 0xbe, 0xae} \
+}
+
+class nsIFactory;
+
+class GContentHandler : public nsIHelperAppLauncherDialog
+{
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIHELPERAPPLAUNCHERDIALOG
+
+ GContentHandler();
+ virtual ~GContentHandler();
+
+ NS_METHOD FindHelperApp (void);
+ NS_METHOD LaunchHelperApp (void);
+ NS_METHOD ShowHelperProgressDialog (void);
+
+ NS_METHOD GetLauncher (nsIHelperAppLauncher * *_retval);
+ NS_METHOD GetContext (nsISupports * *_retval);
+ NS_METHOD SetHelperApp(GnomeVFSMimeApplication *mHelperApp,
+ PRBool alwaysUse);
+ NS_METHOD SynchroniseMIMEInfo (void);
+
+ private:
+ /* additional members */
+ NS_METHOD Init (void);
+ NS_METHOD ProcessMimeInfo (void);
+ NS_METHOD MIMEAskAction (void);
+
+ nsCOMPtr<nsIHelperAppLauncher> mLauncher;
+ nsCOMPtr<nsISupports> mContext;
+
+ nsCOMPtr<nsIURI> mUri;
+ PRInt64 mTimeDownloadStarted;
+ nsCOMPtr<nsIFile> mTempFile;
+
+ char *mMimeType;
+ PRBool mUrlHelper;
+ GnomeVFSMimeApplication *mHelperApp;
+
+ nsCString mUrl;
+ nsCString mScheme;
+
+ PRBool mDownloadCanceled;
+ PRBool mHelperProgress;
+
+ nsCOMPtr<nsIWebProgressListener> mListener;
+};
+
+extern nsresult NS_NewContentHandlerFactory(nsIFactory** aFactory);
+
+#endif
diff --git a/embed/mozilla/EphyEventListener.cpp b/embed/mozilla/EphyEventListener.cpp
new file mode 100644
index 000000000..de696bf1e
--- /dev/null
+++ b/embed/mozilla/EphyEventListener.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <nsCOMPtr.h>
+
+#include "EphyEventListener.h"
+#include "nsIDOMNode.h"
+#include "nsIDOMElement.h"
+#include "nsString.h"
+#include "nsUnicharUtils.h"
+#include "nsIDOMDocument.h"
+#include "nsIURI.h"
+#include "nsIDocument.h"
+#include "nsIDOMEventTarget.h"
+#include "nsIDOMEvent.h"
+
+EphyEventListener::EphyEventListener(void)
+{
+ NS_INIT_ISUPPORTS();
+ mOwner = nsnull;
+}
+
+EphyEventListener::~EphyEventListener()
+{
+}
+
+NS_IMPL_ISUPPORTS1(EphyEventListener, nsIDOMEventListener)
+
+nsresult
+EphyEventListener::Init(EphyEmbed *aOwner)
+{
+ mOwner = aOwner;
+ return NS_OK;
+}
+
+nsresult
+EphyEventListener::HandleFaviconLink (nsIDOMNode *node)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMElement> linkElement;
+ linkElement = do_QueryInterface (node);
+ if (!linkElement) return NS_ERROR_FAILURE;
+
+ NS_NAMED_LITERAL_STRING(attr_rel, "rel");
+ nsAutoString value;
+ result = linkElement->GetAttribute (attr_rel, value);
+ if (NS_FAILED(result)) return NS_ERROR_FAILURE;
+
+ if (value.Equals(NS_LITERAL_STRING("SHORTCUT ICON"),
+ nsCaseInsensitiveStringComparator()) ||
+ value.Equals(NS_LITERAL_STRING("ICON"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ NS_NAMED_LITERAL_STRING(attr_href, "href");
+ nsAutoString value;
+ result = linkElement->GetAttribute (attr_href, value);
+ if (NS_FAILED (result) || value.IsEmpty())
+ return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMDocument> domDoc;
+ result = node->GetOwnerDocument(getter_AddRefs(domDoc));
+ if (NS_FAILED(result) || !domDoc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocument> doc = do_QueryInterface (domDoc);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ result = doc->GetDocumentURL(getter_AddRefs(uri));
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ const nsACString &link = NS_ConvertUCS2toUTF8(value);
+ nsCAutoString favicon_url;
+ result = uri->Resolve (link, favicon_url);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ char *url = g_strdup (favicon_url.get());
+ g_signal_emit_by_name (mOwner, "ge_favicon", url);
+ g_free (url);
+ }
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+EphyEventListener::HandleEvent(nsIDOMEvent* aDOMEvent)
+{
+ nsCOMPtr<nsIDOMEventTarget> eventTarget;
+
+ aDOMEvent->GetTarget(getter_AddRefs(eventTarget));
+
+ nsresult result;
+ nsCOMPtr<nsIDOMNode> node = do_QueryInterface(eventTarget, &result);
+ if (NS_FAILED(result) || !node) return NS_ERROR_FAILURE;
+
+ HandleFaviconLink (node);
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/EphyEventListener.h b/embed/mozilla/EphyEventListener.h
new file mode 100644
index 000000000..32f84e904
--- /dev/null
+++ b/embed/mozilla/EphyEventListener.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_EVENT_LISTENER_H
+#define EPHY_EVENT_LISTENER_H
+
+#include "ephy-embed.h"
+
+#include <nsIDOMEventListener.h>
+
+class EphyEventListener : public nsIDOMEventListener
+{
+public:
+ EphyEventListener();
+ virtual ~EphyEventListener();
+
+ nsresult Init(EphyEmbed *aOwner);
+
+ NS_DECL_ISUPPORTS
+
+ // nsIDOMEventListener
+
+ NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
+
+private:
+ EphyEmbed *mOwner;
+
+ nsresult HandleFaviconLink (nsIDOMNode *node);
+};
+
+#endif
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp
new file mode 100644
index 000000000..ade9e67b2
--- /dev/null
+++ b/embed/mozilla/EphyWrapper.cpp
@@ -0,0 +1,1384 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "EphyWrapper.h"
+#include "GlobalHistory.h"
+#include "ProgressListener.h"
+#include "PrintProgressListener.h"
+#include "ephy-embed.h"
+#include "ephy-string.h"
+
+#include <gtkmozembed_internal.h>
+#include <unistd.h>
+
+#include "nsIContentViewer.h"
+#include "nsIPermissionManager.h"
+#include "nsIGlobalHistory.h"
+#include "nsIDocShellHistory.h"
+#include "nsIWebBrowserFind.h"
+#include "nsIWebBrowserFocus.h"
+#include "nsIDocument.h"
+#include "nsISHEntry.h"
+#include "nsISHistoryInternal.h"
+#include "nsIHistoryEntry.h"
+#include "nsIWebBrowserPrint.h"
+#include "nsIURI.h"
+#include "nsIPresShell.h"
+#include "nsIMarkupDocumentViewer.h"
+#include "nsIComponentManager.h"
+#include "nsIDOMElement.h"
+#include "nsIDOMNodeList.h"
+#include "nsIScriptGlobalObject.h"
+#include "nsIScriptContext.h"
+
+#include "nsIDOMWindowInternal.h"
+#include "nsICharsetConverterManager.h"
+#include "nsICharsetConverterManager2.h"
+#include "nsIInterfaceRequestor.h"
+#include "nsIFocusController.h"
+#include "nsIWebBrowserPersist.h"
+#include "nsCWebBrowserPersist.h"
+#include "nsNetUtil.h"
+#include "nsIChromeEventHandler.h"
+#include "nsIClipboardCommands.h"
+#include "nsIDOMDocumentStyle.h"
+#include "nsIDocShellTreeItem.h"
+#include "nsIDocShellTreeNode.h"
+#include "nsIDocShellTreeOwner.h"
+#include "nsIHTMLContentContainer.h"
+#include "nsICSSLoader.h"
+#include "nsICSSStyleSheet.h"
+#include "nsICSSLoaderObserver.h"
+#include "nsIStyleSet.h"
+#include "nsIDocumentObserver.h"
+#include "nsCWebBrowser.h"
+#include "nsReadableUtils.h"
+#include "nsUnicharUtils.h"
+#include "nsIDOMNSHTMLDocument.h"
+#include "nsIDOMHTMLDocument.h"
+#include "nsIDOMHTMLCollection.h"
+#include "nsIDOMHTMLElement.h"
+#include "nsIDOMHTMLImageElement.h"
+#include "nsIDOMHTMLFormElement.h"
+#include "nsIDOMHTMLAnchorElement.h"
+#include "caps/nsIPrincipal.h"
+#include "nsIDeviceContext.h"
+#include "nsIPresContext.h"
+#include "ContentHandler.h"
+#include "nsITypeAheadFind.h"
+#include "nsSupportsPrimitives.h"
+#include "EphyEventListener.h"
+
+EphyWrapper::EphyWrapper ()
+{
+}
+
+EphyWrapper::~EphyWrapper ()
+{
+}
+
+nsresult EphyWrapper::Init (GtkMozEmbed *mozembed)
+{
+ nsresult result;
+
+ gtk_moz_embed_get_nsIWebBrowser (mozembed,
+ getter_AddRefs(mWebBrowser));
+ if (!mWebBrowser) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocShellHistory> dsHistory = do_QueryInterface (DocShell);
+ if (!dsHistory) return NS_ERROR_FAILURE;
+
+ static NS_DEFINE_CID(kGlobalHistoryCID, GALEON_GLOBALHISTORY_CID);
+
+ nsCOMPtr<nsIFactory> GHFactory;
+ result = NS_NewGlobalHistoryFactory(getter_AddRefs(GHFactory));
+ if (NS_FAILED(result)) return NS_ERROR_FAILURE;
+
+ result = nsComponentManager::RegisterFactory(kGlobalHistoryCID,
+ "Global history",
+ NS_GLOBALHISTORY_CONTRACTID,
+ GHFactory,
+ PR_TRUE);
+
+ nsCOMPtr<nsIGlobalHistory> inst =
+ do_GetService(NS_GLOBALHISTORY_CONTRACTID, &result);
+
+ mEventListener = new EphyEventListener();
+ mEventListener->Init (EPHY_EMBED (mozembed));
+ GetListener();
+ AttachListeners();
+
+ return dsHistory->SetGlobalHistory(inst);
+}
+
+void
+EphyWrapper::GetListener (void)
+{
+ if (mEventReceiver) return;
+
+ nsCOMPtr<nsIDOMWindow> domWindowExternal;
+ mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindowExternal));
+
+ nsCOMPtr<nsIDOMWindowInternal> domWindow;
+ domWindow = do_QueryInterface(domWindowExternal);
+
+ nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(domWindow));
+ if (!piWin) return;
+
+ nsCOMPtr<nsIChromeEventHandler> chromeHandler;
+ piWin->GetChromeEventHandler(getter_AddRefs(chromeHandler));
+
+ mEventReceiver = do_QueryInterface(chromeHandler);
+}
+
+void
+EphyWrapper::AttachListeners(void)
+{
+ if (!mEventReceiver || mListenersAttached)
+ return;
+
+ nsCOMPtr<nsIDOMEventTarget> target;
+ target = do_QueryInterface (mEventReceiver);
+
+ target->AddEventListener(NS_LITERAL_STRING("DOMLinkAdded"), mEventListener, PR_FALSE);
+
+ mListenersAttached = PR_TRUE;
+}
+
+void
+EphyWrapper::DetachListeners(void)
+{
+ if (!mListenersAttached || !mEventReceiver)
+ return;
+
+ nsCOMPtr<nsIDOMEventTarget> target;
+ target = do_QueryInterface (mEventReceiver);
+
+ target->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), mEventListener, PR_FALSE);
+}
+
+nsresult EphyWrapper::GetDocShell (nsIDocShell **aDocShell)
+{
+ nsCOMPtr<nsIDocShellTreeItem> browserAsItem;
+ browserAsItem = do_QueryInterface(mWebBrowser);
+ if (!browserAsItem) return NS_ERROR_FAILURE;
+
+ // get the owner for that item
+ nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
+ browserAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
+ if (!treeOwner) return NS_ERROR_FAILURE;
+
+ // get the primary content shell as an item
+ nsCOMPtr<nsIDocShellTreeItem> contentItem;
+ treeOwner->GetPrimaryContentShell(getter_AddRefs(contentItem));
+ if (!contentItem) return NS_ERROR_FAILURE;
+
+ // QI that back to a docshell
+ nsCOMPtr<nsIDocShell> DocShell;
+ DocShell = do_QueryInterface(contentItem);
+ if (!DocShell) return NS_ERROR_FAILURE;
+
+ *aDocShell = DocShell.get();
+
+ NS_IF_ADDREF(*aDocShell);
+
+ return NS_OK;
+}
+nsresult EphyWrapper::Print (nsIPrintSettings *options, PRBool preview)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &result));
+ if (NS_FAILED(result) || !print) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = mWebBrowser->GetContentDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
+
+ if (!preview)
+ {
+ GPrintListener *listener = new GPrintListener();
+ result = print->Print (options, listener);
+ }
+ else
+ {
+ result = print->PrintPreview(options, nsnull, nsnull);
+ }
+
+ return result;
+}
+
+nsresult EphyWrapper::PrintPreviewClose (void)
+{
+ nsresult rv;
+ PRBool isPreview = PR_FALSE;
+
+ nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &rv));
+ if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
+
+ rv = print->GetDoingPrintPreview(&isPreview);
+ if (isPreview == PR_TRUE)
+ {
+ rv = print->ExitPrintPreview();
+ }
+
+ return rv;
+}
+
+nsresult EphyWrapper::PrintPreviewNumPages (int *numPages)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &rv));
+ if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
+
+ rv = print->GetPrintPreviewNumPages(numPages);
+ return rv;
+}
+
+nsresult EphyWrapper::PrintPreviewNavigate(PRInt16 navType, PRInt32 pageNum)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &rv));
+ if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
+
+ rv = print->PrintPreviewNavigate(navType, pageNum);
+ return rv;
+}
+
+nsresult EphyWrapper::GetPrintSettings (nsIPrintSettings **options)
+{
+ nsresult result;
+ nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &result));
+ if (NS_FAILED(result) || !print) return NS_ERROR_FAILURE;
+
+ return print->GetGlobalPrintSettings(options);
+}
+
+nsresult EphyWrapper::GetSHistory (nsISHistory **aSHistory)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (DocShell,
+ &result);
+ if (!ContentNav) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsISHistory> SessionHistory;
+ result = ContentNav->GetSessionHistory (getter_AddRefs (SessionHistory));
+ if (!SessionHistory) return NS_ERROR_FAILURE;
+
+ *aSHistory = SessionHistory.get();
+ NS_IF_ADDREF (*aSHistory);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::Destroy ()
+{
+ DetachListeners ();
+
+ mWebBrowser = nsnull;
+ mChromeNav = nsnull;
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GoToHistoryIndex (PRInt16 index)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (DocShell,
+ &result);
+ if (!ContentNav) return NS_ERROR_FAILURE;
+
+ return ContentNav->GotoIndex (index);
+}
+
+nsresult EphyWrapper::SetZoom (float aZoom, PRBool reflow)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ if (reflow)
+ {
+ nsCOMPtr<nsIContentViewer> contentViewer;
+ result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
+ if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer,
+ &result);
+ if (NS_FAILED(result) || !mdv) return NS_ERROR_FAILURE;
+
+ return mdv->SetTextZoom (aZoom);
+ }
+ else
+ {
+ SetZoomOnDocshell (aZoom, DocShell);
+
+ nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(DocShell));
+ if (docShellNode)
+ {
+ PRInt32 i;
+ PRInt32 n;
+ docShellNode->GetChildCount(&n);
+ for (i=0; i < n; i++)
+ {
+ nsCOMPtr<nsIDocShellTreeItem> child;
+ docShellNode->GetChildAt(i, getter_AddRefs(child));
+ nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
+ if (childAsShell)
+ {
+ return SetZoomOnDocshell (aZoom, childAsShell);
+ }
+ }
+ }
+ }
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIPresContext> PresContext;
+ result = DocShell->GetPresContext (getter_AddRefs(PresContext));
+ if (NS_FAILED(result)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDeviceContext> DeviceContext;
+ result = PresContext->GetDeviceContext (getter_AddRefs(DeviceContext));
+
+ return DeviceContext->SetTextZoom (aZoom);
+}
+
+nsresult EphyWrapper::GetZoom (float *aZoom)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIContentViewer> contentViewer;
+ result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
+ if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer,
+ &result);
+ if (NS_FAILED(result) || !mdv) return NS_ERROR_FAILURE;
+
+ return mdv->GetTextZoom (aZoom);
+}
+
+nsresult EphyWrapper::GetFocusedDOMWindow (nsIDOMWindow **aDOMWindow)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIWebBrowserFocus> focus = do_GetInterface(mWebBrowser, &rv);
+ if (NS_FAILED(rv) || !focus) return NS_ERROR_FAILURE;
+
+ rv = focus->GetFocusedWindow (aDOMWindow);
+ if (NS_FAILED(rv))
+ rv = mWebBrowser->GetContentDOMWindow (aDOMWindow);
+ return rv;
+}
+
+nsresult EphyWrapper::GetDOMWindow (nsIDOMWindow **aDOMWindow)
+{
+ nsresult rv;
+
+ rv = mWebBrowser->GetContentDOMWindow (aDOMWindow);
+
+ return rv;
+}
+
+nsresult EphyWrapper::GetDOMDocument (nsIDOMDocument **aDOMDocument)
+{
+ nsresult result;
+
+ /* Use the current target document */
+ if (mTargetDocument)
+ {
+ *aDOMDocument = mTargetDocument.get();
+
+ NS_IF_ADDREF(*aDOMDocument);
+
+ return NS_OK;
+ }
+
+ /* Use the focused document */
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_SUCCEEDED(result) && DOMWindow)
+ {
+ return DOMWindow->GetDocument (aDOMDocument);
+ }
+
+ /* Use the main document */
+ return GetMainDOMDocument (aDOMDocument);
+}
+
+nsresult EphyWrapper::GetMainDOMDocument (nsIDOMDocument **aDOMDocument)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIContentViewer> contentViewer;
+ result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
+ if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
+
+ return contentViewer->GetDOMDocument (aDOMDocument);
+}
+
+nsresult EphyWrapper::GetSHInfo (PRInt32 *count, PRInt32 *index)
+{
+ nsresult result;
+
+ nsCOMPtr<nsISHistory> SessionHistory;
+ result = GetSHistory (getter_AddRefs(SessionHistory));
+ if (NS_FAILED(result) || ! SessionHistory) return NS_ERROR_FAILURE;
+
+ SessionHistory->GetCount (count);
+ SessionHistory->GetIndex (index);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetSHTitleAtIndex (PRInt32 index, PRUnichar **title)
+{
+ nsresult result;
+
+ nsCOMPtr<nsISHistory> SessionHistory;
+ result = GetSHistory (getter_AddRefs(SessionHistory));
+ if (NS_FAILED(result) || ! SessionHistory) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIHistoryEntry> he;
+ result = SessionHistory->GetEntryAtIndex (index, PR_FALSE,
+ getter_AddRefs (he));
+ if (!NS_SUCCEEDED(result) || (!he)) return NS_ERROR_FAILURE;
+
+ result = he->GetTitle (title);
+ if (!NS_SUCCEEDED(result) || (!title)) return NS_ERROR_FAILURE;
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetSHUrlAtIndex (PRInt32 index, nsCString &url)
+{
+ nsresult result;
+
+ nsCOMPtr<nsISHistory> SessionHistory;
+ result = GetSHistory (getter_AddRefs(SessionHistory));
+ if (NS_FAILED(result) || ! SessionHistory) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIHistoryEntry> he;
+ result = SessionHistory->GetEntryAtIndex (index, PR_FALSE,
+ getter_AddRefs (he));
+ if (NS_FAILED(result) || (!he)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ result = he->GetURI (getter_AddRefs(uri));
+ if (NS_FAILED(result) || (!uri)) return NS_ERROR_FAILURE;
+
+ result = uri->GetSpec(url);
+ if (NS_FAILED(result) || url.IsEmpty()) return NS_ERROR_FAILURE;
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::Find (const PRUnichar *search_string,
+ PRBool interactive,
+ PRBool matchcase, PRBool search_backwards,
+ PRBool search_wrap_around,
+ PRBool search_for_entire_word,
+ PRBool search_in_frames,
+ PRBool *didFind)
+{
+ if (!interactive)
+ {
+ nsresult rv;
+ nsCOMPtr<nsITypeAheadFind> tAFinder
+ (do_GetService(NS_TYPEAHEADFIND_CONTRACTID, &rv));
+ if (NS_SUCCEEDED(rv))
+ {
+ nsCOMPtr<nsIDOMWindow> aFocusedWindow;
+ rv = GetFocusedDOMWindow(getter_AddRefs(aFocusedWindow));
+ if (NS_SUCCEEDED(rv))
+ {
+ nsSupportsInterfacePointerImpl windowPtr;
+ windowPtr.SetData(aFocusedWindow);
+
+ tAFinder->FindNext(search_backwards, &windowPtr);
+
+ nsCOMPtr<nsISupports> retValue;
+ rv = windowPtr.GetData(getter_AddRefs(retValue));
+ if (NS_SUCCEEDED(rv) && !retValue)
+ {
+ *didFind = PR_TRUE;
+ return NS_OK;
+ }
+ }
+ }
+
+ }
+
+ nsCOMPtr<nsIWebBrowserFind> finder (do_GetInterface(mWebBrowser));
+
+ finder->SetSearchString (search_string);
+ finder->SetFindBackwards (search_backwards);
+ finder->SetWrapFind (search_wrap_around);
+ finder->SetEntireWord (search_for_entire_word);
+ finder->SetMatchCase (matchcase);
+ finder->SetSearchFrames (search_in_frames);
+ return finder->FindNext(didFind);
+}
+
+nsresult EphyWrapper::GetWebNavigation(nsIWebNavigation **aWebNavigation)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIScriptGlobalObject> scriptGlobal = do_QueryInterface(DOMWindow);
+ if (!scriptGlobal) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocShell> docshell;
+ if (NS_FAILED(scriptGlobal->GetDocShell(getter_AddRefs(docshell))))
+ return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebNavigation> wn = do_QueryInterface (docshell, &result);
+ if (!wn || !NS_SUCCEEDED (result)) return NS_ERROR_FAILURE;
+
+ NS_IF_ADDREF(*aWebNavigation = wn);
+ return NS_OK;
+}
+
+nsresult EphyWrapper::ReloadDocument ()
+{
+ nsresult result;
+
+ nsCOMPtr<nsIWebNavigation> wn;
+ result = GetWebNavigation(getter_AddRefs(wn));
+ if (!wn || !NS_SUCCEEDED (result)) return NS_ERROR_FAILURE;
+
+ result = wn->Reload (nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE |
+ nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY);
+ if (!NS_SUCCEEDED (result)) return NS_ERROR_FAILURE;
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::LoadDocument(nsISupports *aPageDescriptor,
+ PRUint32 aDisplayType)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIWebNavigation> wn;
+ rv = GetWebNavigation(getter_AddRefs(wn));
+ if (!wn || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebPageDescriptor> wpd = do_QueryInterface(wn, &rv);
+ if (!wpd || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
+
+ return wpd->LoadPage(aPageDescriptor, aDisplayType);
+}
+
+nsresult EphyWrapper::GetPageDescriptor(nsISupports **aPageDescriptor)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIWebNavigation> wn;
+ rv = GetWebNavigation(getter_AddRefs(wn));
+ if (!wn || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebPageDescriptor> wpd = do_QueryInterface(wn, &rv);
+ if (!wpd || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
+
+ return wpd->GetCurrentDescriptor(aPageDescriptor);
+}
+
+nsresult EphyWrapper::GetMainDocumentUrl (nsCString &url)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+
+ result = GetMainDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+
+ return uri->GetSpec (url);
+}
+
+nsresult EphyWrapper::GetDocumentUrl (nsCString &url)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+
+ result = GetDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+
+ uri->GetSpec (url);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetDocumentTitle (char **title)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+
+ result = GetDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ const nsString* t;
+ t = doc->GetDocumentTitle();
+
+ *title = g_strdup (NS_ConvertUCS2toUTF8(*t).get());
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::CopyHistoryTo (EphyWrapper *dest)
+{
+ nsresult result;
+ int count,index;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebNavigation> wn_src = do_QueryInterface (DocShell,
+ &result);
+ if (!wn_src) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsISHistory> h_src;
+ result = wn_src->GetSessionHistory (getter_AddRefs (h_src));
+ if (!NS_SUCCEEDED(result) || (!h_src)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDocShell> destDocShell;
+ result = dest->GetDocShell (getter_AddRefs(destDocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebNavigation> wn_dest = do_QueryInterface (destDocShell,
+ &result);
+ if (!wn_dest) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsISHistory> h_dest;
+ result = wn_dest->GetSessionHistory (getter_AddRefs (h_dest));
+ if (!NS_SUCCEEDED (result) || (!h_dest)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsISHistoryInternal> hi_dest = do_QueryInterface (h_dest);
+ if (!hi_dest) return NS_ERROR_FAILURE;
+
+ h_src->GetCount (&count);
+ h_src->GetIndex (&index);
+
+ if (count) {
+ nsCOMPtr<nsIHistoryEntry> he;
+ nsCOMPtr<nsISHEntry> she;
+
+ for (PRInt32 i = 0; i < count; i++) {
+
+ result = h_src->GetEntryAtIndex (i, PR_FALSE,
+ getter_AddRefs (he));
+ if (!NS_SUCCEEDED(result) || (!he))
+ return NS_ERROR_FAILURE;
+
+ she = do_QueryInterface (he);
+ if (!she) return NS_ERROR_FAILURE;
+
+ result = hi_dest->AddEntry (she, PR_TRUE);
+ if (!NS_SUCCEEDED(result) || (!she))
+ return NS_ERROR_FAILURE;
+ }
+
+ result = wn_dest->GotoIndex(index);
+ if (!NS_SUCCEEDED(result)) return NS_ERROR_FAILURE;
+ }
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::ForceCharacterSet (char *charset)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIContentViewer> contentViewer;
+ result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
+ if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer,
+ &result);
+ if (NS_FAILED(result) || !mdv) return NS_ERROR_FAILURE;
+
+ result = mdv->SetForceCharacterSet (NS_ConvertUTF8toUCS2(charset).get());
+
+ return result;
+}
+
+nsresult EphyWrapper::CanCutSelection(PRBool *result)
+{
+ nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser));
+ return clipboard->CanCutSelection (result);
+}
+
+nsresult EphyWrapper::CanCopySelection(PRBool *result)
+{
+ nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser));
+ return clipboard->CanCopySelection (result);
+}
+
+nsresult EphyWrapper::CanPaste(PRBool *result)
+{
+ nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser));
+ return clipboard->CanPaste (result);
+}
+
+nsresult EphyWrapper::CutSelection(void)
+{
+ nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser));
+ return clipboard->CutSelection ();
+}
+
+nsresult EphyWrapper::CopySelection(void)
+{
+ nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser));
+ return clipboard->CopySelection ();
+}
+
+nsresult EphyWrapper::Paste(void)
+{
+ nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser));
+ return clipboard->Paste ();
+}
+
+nsresult EphyWrapper::GetLinkInterfaceItems (GList **list)
+{
+#ifdef NOT_PORTED
+ nsresult result;
+ PRUint32 links_count;
+
+ /* we accept these rel=.. elements, specified by the w3c */
+ const gchar *rel_types[] = {
+ "START", "NEXT", "PREV", "PREVIOUS", "CONTENTS", "TOC", "INDEX",
+ "GLOSSARY", "COPYRIGHT", "CHAPTER", "SECTION",
+ "SUBSECTION", "APPENDIX", "HELP", "TOP", "SEARCH", "MADE",
+ "BOOKMARK", "HOME",
+ NULL /* terminator, must be last */
+ };
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+ result = GetMainDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ /* get list of link elements*/
+ NS_NAMED_LITERAL_STRING(strname, "LINK");
+
+ nsCOMPtr<nsIDOMNodeList> links;
+ result = aDOMDocument->GetElementsByTagName (strname,
+ getter_AddRefs (links));
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ result = links->GetLength (&links_count);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ for (PRUint32 i = 0; i < links_count; i++)
+ {
+ /* get to the link element */
+ nsCOMPtr<nsIDOMNode> link;
+ result = links->Item (i, getter_AddRefs (link));
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMElement> linkElement;
+ linkElement = do_QueryInterface (aLink);
+ if (!linkElement) return NS_ERROR_FAILURE;
+
+ /* get rel=.. element */
+ NS_NAMED_LITERAL_STRING(attr_rel, "rel");
+ nsAutoString value;
+ linkElement->GetAttribute (attr_rel, value);
+
+ if (value.IsEmpty())
+ {
+ NS_NAMED_LITERAL_STRING(attr_rev, "rev");
+ linkElement->GetAttribute (attr_rev, value);
+ if (value.IsEmpty()) continue;
+ }
+
+ nsCString relstr = NS_ConvertUCS2toUTF8(value);
+ ToUpperCase(relstr);
+
+ /* check for elements we want */
+ for (gint j = 0; (rel_types[j] != NULL); j++)
+ {
+ if (strcmp (relstr.get(), rel_types[j]) == 0)
+ {
+ /* found one! */
+ LinkInterfaceItem *lti =
+ g_new0 (LinkInterfaceItem, 1);
+
+ /* fill in struct */
+ lti->type = (LinkInterfaceItemType) j;
+
+ /* get href=.. element */
+ NS_NAMED_LITERAL_STRING(attr_href, "href");
+ nsAutoString value;
+ linkElement->GetAttribute (attr_href, value);
+
+ if (value.IsEmpty())
+ {
+ g_free (lti);
+ continue;
+ }
+
+ /* resolve uri */
+ nsCOMPtr<nsIDocument> doc =
+ do_QueryInterface (aDOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+
+ const nsACString &link = NS_ConvertUCS2toUTF8(value);
+ nsCAutoString href;
+ result = uri->Resolve (link, href);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+ lti->href = g_strdup (href.get());
+
+ /* append to list of items */
+ *list = g_list_append (*list, lti);
+
+ /* get optional title=... element */
+ NS_NAMED_LITERAL_STRING(attr_title, "title");
+ linkElement->GetAttribute (attr_title, value);
+ if (value.IsEmpty()) continue;
+
+ const nsACString &title = NS_ConvertUCS2toUTF8 (value);
+ lti->title = gul_string_strip_newline (PromiseFlatCString(title).get());
+ }
+ }
+ }
+#endif
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetRealURL (nsCString &ret)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDocShell> DocShell;
+ result = GetDocShell (getter_AddRefs(DocShell));
+ if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (DocShell,
+ &result);
+ if (!ContentNav) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ result = ContentNav->GetCurrentURI (getter_AddRefs(uri));
+ if (!NS_SUCCEEDED(result) || (!uri)) return NS_ERROR_FAILURE;
+
+ result = uri->GetSpec(ret);
+ if (!NS_SUCCEEDED(result) || ret.IsEmpty()) return NS_ERROR_FAILURE;
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::SelectAll (void)
+{
+ nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser));
+ return clipboard->SelectAll ();
+}
+
+nsresult EphyWrapper::ScrollUp (void)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
+
+ DOMWindow->ScrollByLines(-1);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::ScrollDown (void)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
+
+ DOMWindow->ScrollByLines(1);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::ScrollLeft (void)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
+
+ DOMWindow->ScrollBy(-16, 0);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::ScrollRight (void)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
+
+ DOMWindow->ScrollBy(16, 0);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::FineScroll (int horiz, int vert)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
+
+ DOMWindow->ScrollBy(horiz, vert);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetLastModified (gchar **ret)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+
+ result = GetDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMNSHTMLDocument> doc = do_QueryInterface(DOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsAutoString value;
+ doc->GetLastModified(value);
+
+ *ret = g_strdup (NS_ConvertUCS2toUTF8(value).get());
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetImages (GList **ret)
+{
+#ifdef NOT_PORTED
+ nsresult result;
+ GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+
+ result = GetDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMHTMLDocument> doc = do_QueryInterface(DOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMHTMLCollection> col;
+ doc->GetImages(getter_AddRefs(col));
+
+ PRUint32 count, i;
+ col->GetLength(&count);
+ for (i = 0; i < count; i++)
+ {
+ nsCOMPtr<nsIDOMNode> node;
+ col->Item(i, getter_AddRefs(node));
+ if (!node) continue;
+
+ nsCOMPtr<nsIDOMHTMLElement> element;
+ element = do_QueryInterface(node);
+ if (!element) continue;
+
+ nsCOMPtr<nsIDOMHTMLImageElement> img;
+ img = do_QueryInterface(element);
+ if (!img) continue;
+
+ ImageListItem *item = g_new0 (ImageListItem, 1);
+
+ nsAutoString tmp;
+ result = img->GetSrc (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUCS2toUTF8(tmp);
+ if (g_hash_table_lookup (hash, PromiseFlatCString(c).get()))
+ {
+ g_free (item);
+ continue;
+ }
+ item->url = g_strdup (c.get());
+ g_hash_table_insert (hash, item->url,
+ GINT_TO_POINTER (TRUE));
+ }
+ result = img->GetAlt (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUCS2toUTF8(tmp);
+ item->alt = gul_string_strip_newline (PromiseFlatCString(c).get());
+ }
+ result = element->GetTitle (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUCS2toUTF8(tmp);
+ item->title = gul_string_strip_newline (PromiseFlatCString(c).get());
+ }
+ result = img->GetWidth (&(item->width));
+ result = img->GetHeight (&(item->height));
+
+ *ret = g_list_append (*ret, item);
+ }
+
+ g_hash_table_destroy (hash);
+#endif
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetForms (GList **ret)
+{
+#ifdef NOT_PORTED
+ nsresult result;
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+
+ result = GetDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMHTMLDocument> doc = do_QueryInterface(DOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMHTMLCollection> col;
+ doc->GetForms(getter_AddRefs(col));
+
+ PRUint32 count, i;
+ col->GetLength(&count);
+ for (i = 0; i < count; i++)
+ {
+ nsCOMPtr<nsIDOMNode> node;
+ col->Item(i, getter_AddRefs(node));
+ if (!node) continue;
+
+ nsCOMPtr<nsIDOMHTMLElement> element;
+ element = do_QueryInterface(node);
+ if (!element) continue;
+
+ nsCOMPtr<nsIDOMHTMLFormElement> form;
+ form = do_QueryInterface(element);
+ if (!form) continue;
+
+ FormListItem *item = g_new0 (FormListItem, 1);
+
+ nsAutoString tmp;
+ result = form->GetAction (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ nsCOMPtr<nsIDocument> doc =
+ do_QueryInterface (aDOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+
+ const nsACString &s = NS_ConvertUTF8toUCS2(tmp);
+ nsCAutoString c;
+ result = uri->Resolve (c, s);
+
+ item->action = s.Length() ? g_strdup (s.get()) : g_strdup (c.get());
+ }
+ result = form->GetMethod (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUTF8toUCS2(tmp);
+ item->method = g_strdup (PromiseFlatCString(c).get());
+ }
+ result = form->GetName (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUTF8toUCS2(tmp);
+ item->name = g_strdup (PromiseFlatCString(c).get());
+ }
+
+ *ret = g_list_append (*ret, item);
+ }
+#endif
+ return NS_OK;
+}
+
+nsresult EphyWrapper::GetLinks (GList **ret)
+{
+#ifdef NOT_PORTED
+ nsresult result;
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+ result = GetMainDOMDocument (getter_AddRefs(DOMDocument));
+ if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
+
+ /* first, get a list of <link> elements */
+ PRUint32 links_count;
+
+ NS_NAMED_LITERAL_STRING(strname, "LINK");
+
+ nsCOMPtr<nsIDOMNodeList> links;
+ result = DOMDocument->GetElementsByTagName (strname,
+ getter_AddRefs (links));
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ result = aLinks->GetLength (&links_count);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ for (PRUint32 i = 0; i < links_count; i++)
+ {
+ nsCOMPtr<nsIDOMNode> link;
+ result = links->Item (i, getter_AddRefs (link));
+ if (NS_FAILED (result)) continue;
+
+ nsCOMPtr<nsIDOMElement> linkElement;
+ linkElement = do_QueryInterface (link);
+ if (!linkElement) continue;
+
+ NS_NAMED_LITERAL_STRING(attr_href, "href");
+ nsAutoString value;
+ linkElement->GetAttribute (attr_href, value);
+ if (value.IsEmpty()) continue;
+
+ const nsACString &link = NS_ConvertUCS2toUTF8(value);
+
+ if (link.IsEmpty()) continue;
+
+ nsCOMPtr<nsIDocument> doc =
+ do_QueryInterface (aDOMDocument);
+ if(!doc) continue;
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+
+ nsCAutoString tmp;
+ result = uri->Resolve (link, tmp);
+
+ LinkListItem *i = g_new0 (LinkListItem, 1);
+
+ if (!tmp.IsEmpty())
+ {
+ i->url = g_strdup (tmp.get());
+ }
+ else
+ {
+ i->url = g_strdup (link.get());
+ }
+
+ NS_NAMED_LITERAL_STRING(attr_title, "title");
+ linkElement->GetAttribute (attr_title, value);
+ if (!value.IsEmpty())
+ {
+ const nsACString &s = NS_ConvertUCS2toUTF8(value);
+ i->title = gul_string_strip_newline (PromiseFlatCString(s).get());
+ }
+
+ NS_NAMED_LITERAL_STRING(attr_rel, "rel");
+ linkElement->GetAttribute (attr_rel, value);
+ if (!value.IsEmpty())
+ {
+ const nsACString &s = NS_ConvertUCS2toUTF8(value);
+ i->rel = g_strdup (PromiseFlatCString(s).get());
+ g_strdown (i->rel);
+ }
+ if (!i->rel || strlen (i->rel) == 0)
+ {
+ NS_NAMED_LITERAL_STRING(attr_rev, "rev");
+ linkElement->GetAttribute (attr_rev, value);
+ if (!value.IsEmpty())
+ {
+ const nsACString &s = NS_ConvertUCS2toUTF8(value);
+ i->rel = g_strdup (PromiseFlatCString(s).get());
+ g_strdown (i->rel);
+ }
+ }
+
+ *ret = g_list_append (*ret, i);
+ }
+
+ /* next, get a list of anchors */
+ nsCOMPtr<nsIDOMHTMLDocument> doc = do_QueryInterface(aDOMDocument);
+ if(!doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMHTMLCollection> col;
+ doc->GetLinks(getter_AddRefs(col));
+
+ PRUint32 count, i;
+ col->GetLength(&count);
+ for (i = 0; i < count; i++)
+ {
+ nsCOMPtr<nsIDOMNode> node;
+ col->Item(i, getter_AddRefs(node));
+ if (!node) continue;
+
+ nsCOMPtr<nsIDOMHTMLElement> element;
+ element = do_QueryInterface(node);
+ if (!element) continue;
+
+ nsCOMPtr<nsIDOMHTMLAnchorElement> lnk;
+ lnk = do_QueryInterface(element);
+ if (!lnk) continue;
+
+ LinkListItem *i = g_new0 (LinkListItem, 1);
+
+ nsAutoString tmp;
+
+ result = lnk->GetHref (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUCS2toUTF8(tmp);
+ i->url = g_strdup (PromiseFlatCString(c).get());
+ }
+
+ result = lnk->GetRel (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUCS2toUTF8(tmp);
+ i->rel = g_strdup (PromiseFlatCString(c).get());
+ g_strdown (i->rel);
+ }
+
+ if (!i->rel || strlen (i->rel) == 0)
+ {
+ result = lnk->GetRev (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUCS2toUTF8(tmp);
+ i->rel = g_strdup (PromiseFlatCString(c).get());
+ g_strdown (i->rel);
+ }
+ }
+
+ i->title = mozilla_get_link_text (node);
+ if (i->title == NULL)
+ {
+ result = element->GetTitle (tmp);
+ if (NS_SUCCEEDED(result))
+ {
+ const nsACString &c = NS_ConvertUCS2toUTF8(tmp);
+ i->title = gul_string_strip_newline (PromiseFlatCString(c).get());
+ }
+ }
+
+
+ *ret = g_list_append (*ret, i);
+ }
+#endif
+ return NS_OK;
+}
+
+nsresult EphyWrapper::EvaluateJS (char *script)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
+ rv = mWebBrowser->GetContentDOMWindow(getter_AddRefs(DOMWindow));
+
+ nsCOMPtr<nsIScriptGlobalObject> globalObject;
+ globalObject = do_QueryInterface (DOMWindow);
+ if (!globalObject) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIScriptContext> context;
+ rv = globalObject->GetContext(getter_AddRefs(context));
+ if (NS_FAILED(rv) || !context) {
+ return NS_ERROR_FAILURE;
+ }
+
+ context->SetProcessingScriptTag(PR_TRUE);
+
+ PRBool isUndefined;
+ nsAutoString ret;
+ const nsAString &aScript = NS_ConvertUTF8toUCS2(script);
+ context->EvaluateString(aScript, nsnull, nsnull, nsnull,
+ 0, nsnull,
+ ret, &isUndefined);
+
+ context->SetProcessingScriptTag(PR_FALSE);
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::PushTargetDocument (nsIDOMDocument *domDoc)
+{
+ mTargetDocument = domDoc;
+
+ return NS_OK;
+}
+
+nsresult EphyWrapper::PopTargetDocument ()
+{
+ mTargetDocument = nsnull;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h
new file mode 100644
index 000000000..04379546c
--- /dev/null
+++ b/embed/mozilla/EphyWrapper.h
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_WRAPPER_H
+#define EPHY_WRAPPER_H
+
+#include "nsIDocShell.h"
+#include "ProgressListener.h"
+#include "nsIWebNavigation.h"
+#include "nsIWebPageDescriptor.h"
+#include "nsISHistory.h"
+#include "nsIWebBrowser.h"
+#include "nsIWebProgressListener.h"
+#include "nsCOMPtr.h"
+#include "nsIDOMEventReceiver.h"
+#include "nsIDOMDocument.h"
+#include "nsPIDOMWindow.h"
+#include <gtkmozembed.h>
+
+#include "nsIPrintSettings.h"
+
+class EphyEventListener;
+
+class EphyWrapper
+{
+public:
+ EphyWrapper();
+ ~EphyWrapper();
+
+ nsresult Init (GtkMozEmbed *mozembed);
+ nsresult Destroy (void);
+
+ nsresult SetZoom (float aTextZoom, PRBool reflow);
+ nsresult GetZoom (float *aTextZoom);
+
+ nsresult Print (nsIPrintSettings *options, PRBool preview);
+ nsresult GetPrintSettings (nsIPrintSettings * *options);
+ nsresult PrintPreviewClose (void);
+ nsresult PrintPreviewNumPages (int *numPages);
+ nsresult PrintPreviewNavigate(PRInt16 navType, PRInt32 pageNum);
+
+ nsresult Find (const PRUnichar *search_string,
+ PRBool matchcase, PRBool interactive,
+ PRBool search_backwards, PRBool search_wrap_around,
+ PRBool search_for_entire_word, PRBool search_in_frames,
+ PRBool *didFind);
+
+ nsresult GetMainDocumentUrl (nsCString &url);
+ nsresult GetDocumentUrl (nsCString &url);
+ nsresult GetDocumentTitle (char **title);
+
+ nsresult ReloadDocument ();
+ nsresult LoadDocument(nsISupports *aPageDescriptor, PRUint32 aDisplayType);
+ nsresult GetPageDescriptor(nsISupports **aPageDescriptor);
+
+ nsresult GetSHInfo (PRInt32 *count, PRInt32 *index);
+ nsresult GetSHTitleAtIndex (PRInt32 index, PRUnichar **title);
+ nsresult GetSHUrlAtIndex (PRInt32 index, nsCString &url);
+
+ nsresult CopyHistoryTo (EphyWrapper *embed);
+
+ nsresult GoToHistoryIndex (PRInt16 index);
+
+ nsresult ForceCharacterSet (char *charset);
+
+ nsresult CanCutSelection(PRBool *result);
+
+ nsresult CanCopySelection(PRBool *result);
+
+ nsresult CanPaste(PRBool *result);
+
+ nsresult CutSelection(void);
+
+ nsresult CopySelection(void);
+
+ nsresult Paste(void);
+
+ nsresult Activate ();
+ nsresult Deactivate ();
+
+ nsresult GetMainDOMDocument (nsIDOMDocument **aDOMDocument);
+
+ nsresult GetLinkInterfaceItems (GList **list);
+
+ nsresult GetRealURL (nsCString &ret);
+
+ nsresult SelectAll (void);
+
+ nsresult ScrollUp (void);
+ nsresult ScrollDown (void);
+ nsresult ScrollLeft (void);
+ nsresult ScrollRight (void);
+
+ nsresult FineScroll (int horiz, int vert);
+
+ nsresult GetLastModified (gchar **ret);
+ nsresult GetImages (GList **ret);
+ nsresult GetForms (GList **ret);
+ nsresult GetLinks (GList **ret);
+ nsresult EvaluateJS (char *script);
+
+ nsresult PushTargetDocument (nsIDOMDocument *domDoc);
+ nsresult PopTargetDocument ();
+
+ nsresult GetDOMDocument (nsIDOMDocument **aDOMDocument);
+ nsresult GetDOMWindow (nsIDOMWindow **aDOMWindow);
+
+ nsCOMPtr<nsIWebBrowser> mWebBrowser;
+
+ nsCOMPtr<nsIWebNavigation> mChromeNav;
+
+ GtkMozEmbed *mGtkMozEmbed;
+private:
+ nsCOMPtr<nsIDOMDocument> mTargetDocument;
+ nsCOMPtr<nsIWebProgressListener> mProgress;
+ nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
+ EphyEventListener *mEventListener;
+ PRBool mListenersAttached;
+
+ void GetListener (void);
+ void AttachListeners (void);
+ void DetachListeners (void);
+ nsresult SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell);
+ nsresult GetDocShell (nsIDocShell **aDocShell);
+ nsresult GetCSSBackground (nsIDOMNode *node, nsAutoString& url);
+ nsresult GetFocusedDOMWindow (nsIDOMWindow **aDOMWindow);
+ nsresult GetSHistory (nsISHistory **aSHistory);
+ nsresult GetPIDOMWindow(nsPIDOMWindow **aPIWin);
+ nsresult GetWebNavigation(nsIWebNavigation **aWebNavigation);
+};
+
+#endif
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
new file mode 100644
index 000000000..9d4e312b6
--- /dev/null
+++ b/embed/mozilla/EventContext.cpp
@@ -0,0 +1,669 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "EventContext.h"
+#include "nsIDOMEventTarget.h"
+#include "nsIDocument.h"
+#include "nsIDOMHTMLInputElement.h"
+#include "nsIDOMHTMLObjectElement.h"
+#include "nsIInterfaceRequestor.h"
+#include "nsIDOMHTMLImageElement.h"
+#include "nsIDOMElement.h"
+#include "nsIDOMXULDocument.h"
+#include "nsIURI.h"
+#include "nsIDOMNSDocument.h"
+#include "nsReadableUtils.h"
+#include "nsUnicharUtils.h"
+#include "nsGUIEvent.h"
+#include "nsIDOMNSEvent.h"
+#include "nsIDOMCharacterData.h"
+#include "nsIDOMHTMLButtonElement.h"
+#include "nsIDOMHTMLLabelElement.h"
+#include "nsIDOMHTMLLegendElement.h"
+#include "nsIDOMHTMLTextAreaElement.h"
+#include <gdk/gdkkeysyms.h>
+#include "nsIPrivateDOMEvent.h"
+#include "nsIDOMNSUIEvent.h"
+
+#define KEY_CODE 256
+
+EventContext::EventContext ()
+{
+}
+
+EventContext::~EventContext ()
+{
+}
+
+nsresult EventContext::Init (nsIDOMEvent *event, EphyWrapper *wrapper)
+{
+ mEvent = event;
+ mWrapper = wrapper;
+ mDOMDocument = nsnull;
+
+ return NS_OK;
+}
+
+nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
+ EphyEmbedEvent *info)
+{
+ nsresult rv;
+
+ mEmbedEvent = info;
+
+ info->context = EMBED_CONTEXT_DOCUMENT;
+
+ nsCOMPtr<nsIDOMNode> node = do_QueryInterface(EventTarget, &rv);
+ if (NS_FAILED(rv) || !node) return NS_ERROR_FAILURE;
+
+ /* Is page xul ? then do not display context menus
+ * FIXME I guess there is an easier way ... */
+ /* From philipl: This test needs to be here otherwise we
+ * arrogantly assume we can QI to a HTMLElement, which is
+ * not true for xul content. */
+
+ nsCOMPtr<nsIDOMDocument> domDoc;
+ rv = node->GetOwnerDocument(getter_AddRefs(domDoc));
+ if (NS_FAILED(rv) || !domDoc) return NS_ERROR_FAILURE;
+
+ mDOMDocument = domDoc;
+
+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc, &rv);
+ if (NS_FAILED(rv) || !doc) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMXULDocument> xul_document = do_QueryInterface(domDoc);
+ if (xul_document)
+ {
+ info->context = EMBED_CONTEXT_NONE;
+ return NS_ERROR_FAILURE;
+ }
+
+ // Now we know that the page isn't a xul window, we can try and
+ // do something useful with it.
+
+ PRUint16 type;
+ rv = node->GetNodeType(&type);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(node);
+ if ((nsIDOMNode::ELEMENT_NODE == type) && element)
+ {
+ nsAutoString tag;
+ rv = element->GetTagName(tag);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ if (tag.Equals(NS_LITERAL_STRING("img"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_IMAGE;
+
+ nsAutoString img;
+ nsCOMPtr <nsIDOMHTMLImageElement> image =
+ do_QueryInterface(node, &rv);
+ if (NS_FAILED(rv) || !image) return NS_ERROR_FAILURE;
+
+ rv = image->GetSrc (img);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+ SetStringProperty ("image", img);
+
+ rv = image->GetAlt (img);
+ if (NS_SUCCEEDED(rv))
+ {
+ SetStringProperty ("image_alt", img);
+ }
+
+ rv = image->GetLongDesc (img);
+ if (NS_SUCCEEDED(rv) && !img.IsEmpty())
+ {
+ nsCAutoString imglongdesc;
+ const nsACString &src = NS_ConvertUCS2toUTF8(img);
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+
+ rv = uri->Resolve (src, imglongdesc);
+
+ SetStringProperty ("image_long_desc",
+ NS_ConvertUTF8toUCS2(imglongdesc));
+ }
+
+ int imgwidth, imgheight;
+ rv = image->GetWidth (&imgwidth);
+ rv = image->GetHeight (&imgheight);
+ SetIntProperty ("image_width", imgwidth);
+ SetIntProperty ("image_height", imgheight);
+
+ rv = element->GetTitle (img);
+ if (NS_SUCCEEDED(rv))
+ {
+ SetStringProperty ("image_title",
+ img);
+ }
+ }
+ else if (tag.Equals(NS_LITERAL_STRING("input"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ nsCOMPtr<nsIDOMElement> element;
+ element = do_QueryInterface (node);
+ if (!element) return NS_ERROR_FAILURE;
+
+ NS_NAMED_LITERAL_STRING(attr, "type");
+ nsAutoString value;
+ element->GetAttribute (attr, value);
+
+ if (value.Equals(NS_LITERAL_STRING("image"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_IMAGE;
+ nsCOMPtr<nsIDOMHTMLInputElement> input;
+ input = do_QueryInterface (node);
+ if (!input) return NS_ERROR_FAILURE;
+
+ nsAutoString img;
+ rv = input->GetSrc (img);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsCAutoString cImg;
+ const nsACString &src = NS_ConvertUCS2toUTF8(img);
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+ rv = uri->Resolve (src, cImg);
+ SetStringProperty ("image",
+ NS_ConvertUTF8toUCS2(cImg));
+
+ if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
+ }
+ else if (!value.Equals(NS_LITERAL_STRING("radio"),
+ nsCaseInsensitiveStringComparator()) &&
+ !value.Equals(NS_LITERAL_STRING("submit"),
+ nsCaseInsensitiveStringComparator()) &&
+ !value.Equals(NS_LITERAL_STRING("reset"),
+ nsCaseInsensitiveStringComparator()) &&
+ !value.Equals(NS_LITERAL_STRING("hidden"),
+ nsCaseInsensitiveStringComparator()) &&
+ !value.Equals(NS_LITERAL_STRING("button"),
+ nsCaseInsensitiveStringComparator()) &&
+ !value.Equals(NS_LITERAL_STRING("checkbox"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_INPUT;
+ }
+ }
+ else if (tag.Equals(NS_LITERAL_STRING("textarea"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_INPUT;
+ }
+ else if (tag.Equals(NS_LITERAL_STRING("object"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ nsCOMPtr<nsIDOMHTMLObjectElement> object;
+ object = do_QueryInterface (node);
+ if (!element) return NS_ERROR_FAILURE;
+
+ nsAutoString value;
+ object->GetType(value);
+
+ //Forming a substring and confirming it's contents
+ //is quicker than doing a Find on the full string
+ //and then checking that "image/" is at the beginning
+ if (Substring(value, 0, 6).Equals(NS_LITERAL_STRING("image/"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_IMAGE;
+
+ nsAutoString img;
+
+ rv = object->GetData (img);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsCAutoString cImg;
+ const nsACString &src = NS_ConvertUCS2toUTF8(img);
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+ rv = uri->Resolve (src, cImg);
+ SetStringProperty ("image",
+ NS_ConvertUTF8toUCS2(cImg));
+
+ if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
+ }
+ else
+ {
+ info->context = EMBED_CONTEXT_NONE;
+ return NS_OK;
+ }
+ }
+ }
+
+ /* Is page framed ? */
+ PRBool framed;
+ IsPageFramed (node, &framed);
+ SetIntProperty ("framed_page", framed);
+
+ /* Bubble out, looking for items of interest */
+ while (node)
+ {
+ nsCOMPtr <nsIDOMElement> dom_elem = do_QueryInterface(node);
+ if (dom_elem)
+ {
+ NS_NAMED_LITERAL_STRING(nspace, "http://www.w3.org/1999/xlink");
+ NS_NAMED_LITERAL_STRING(localname_type, "type");
+
+ nsAutoString value;
+ dom_elem->GetAttributeNS (nspace, localname_type, value);
+
+ if (value.Equals(NS_LITERAL_STRING("simple"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_LINK;
+ NS_NAMED_LITERAL_STRING (localname_href, "href");
+ dom_elem->GetAttributeNS (nspace, localname_href, value);
+
+ SetStringProperty ("link", value);
+ }
+ }
+
+ PRUint16 type;
+ rv = node->GetNodeType(&type);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ element = do_QueryInterface(node);
+ if ((nsIDOMNode::ELEMENT_NODE == type) && element)
+ {
+ nsAutoString tag;
+ rv = element->GetTagName(tag);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ /* Link */
+ if (tag.Equals(NS_LITERAL_STRING("a"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ nsCOMPtr <nsIDOMHTMLAnchorElement> anchor =
+ do_QueryInterface(node);
+ nsAutoString tmp;
+ rv = anchor->GetHref (tmp);
+ if (NS_FAILED(rv))
+ return NS_ERROR_FAILURE;
+
+ if (Substring(tmp, 0, 7).Equals(NS_LITERAL_STRING("mailto:"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_EMAIL_LINK;
+ const nsAString &address = Substring(tmp, 7, tmp.Length()-7);
+ SetStringProperty ("email", address);
+ }
+
+ if (anchor && !tmp.IsEmpty())
+ {
+ info->context |= EMBED_CONTEXT_LINK;
+
+ SetStringProperty ("link", tmp);
+ rv = anchor->GetHreflang (tmp);
+ if (NS_SUCCEEDED(rv))
+ SetStringProperty ("link_lang", tmp);
+ rv = anchor->GetTarget (tmp);
+ if (NS_SUCCEEDED(rv))
+ SetStringProperty ("link_target", tmp);
+ rv = anchor->GetRel (tmp);
+ if (NS_SUCCEEDED(rv))
+ SetStringProperty ("link_rel", tmp);
+ rv = anchor->GetRev (tmp);
+ if (NS_SUCCEEDED(rv))
+ SetStringProperty ("link_rev", tmp);
+ rv = element->GetTitle (tmp);
+ if (NS_SUCCEEDED(rv))
+ SetStringProperty ("link_title", tmp);
+ rv = anchor->GetType (tmp);
+ if (NS_SUCCEEDED(rv))
+ SetStringProperty ("link_type", tmp);
+
+ if (tmp.Equals(NS_LITERAL_STRING("text/smartbookmark"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ SetIntProperty ("link_is_smart", TRUE);
+
+ nsCOMPtr<nsIDOMNode> childNode;
+ node->GetFirstChild (getter_AddRefs(childNode));
+ if (childNode)
+ {
+ nsCOMPtr <nsIDOMHTMLImageElement> image =
+ do_QueryInterface(childNode, &rv);
+
+ if (image)
+ {
+ nsAutoString img;
+ rv = image->GetSrc (img);
+ if (!NS_FAILED(rv))
+ {
+ SetStringProperty ("image", img);
+ }
+ }
+ }
+ }
+#ifdef NOT_PORTED
+ /* Get the text of the link */
+ info->linktext = mozilla_get_link_text (node);
+#endif
+ }
+
+ }
+ else if (tag.Equals(NS_LITERAL_STRING("option"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context = EMBED_CONTEXT_NONE;
+ return NS_OK;
+ }
+ if (tag.Equals(NS_LITERAL_STRING("area"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_LINK;
+ nsCOMPtr <nsIDOMHTMLAreaElement> area =
+ do_QueryInterface(node, &rv);
+ if (NS_SUCCEEDED(rv) && area)
+ {
+ nsAutoString href;
+ rv = area->GetHref (href);
+ if (NS_FAILED(rv))
+ return NS_ERROR_FAILURE;
+
+ SetStringProperty ("link", href);
+ }
+ }
+ else if (tag.Equals(NS_LITERAL_STRING("textarea"),
+ nsCaseInsensitiveStringComparator()) ||
+ tag.Equals(NS_LITERAL_STRING("input"),
+ nsCaseInsensitiveStringComparator()))
+ {
+ info->context |= EMBED_CONTEXT_INPUT;
+ }
+
+ nsCOMPtr<nsIDOMElement> domelement;
+ domelement = do_QueryInterface (node);
+ if (!domelement) return NS_ERROR_FAILURE;
+
+ PRBool has_background = PR_FALSE;
+
+ NS_NAMED_LITERAL_STRING(attr, "background");
+ nsAutoString value;
+ domelement->GetAttribute (attr, value);
+
+ if (!value.IsEmpty())
+ {
+ nsCAutoString bgimg;
+ const nsACString &tmp =
+ NS_ConvertUCS2toUTF8(value);
+
+ nsCOMPtr<nsIURI> uri;
+ doc->GetDocumentURL(getter_AddRefs(uri));
+ rv = uri->Resolve (tmp, bgimg);
+ if (NS_FAILED (rv))
+ return NS_ERROR_FAILURE;
+ SetStringProperty ("background_image",
+ NS_ConvertUTF8toUCS2(bgimg));
+ }
+ else
+ {
+ nsCOMPtr<nsIDOMHTMLBodyElement> bgelement;
+ bgelement = do_QueryInterface (node);
+ if (bgelement)
+ {
+ nsAutoString value;
+ bgelement->GetBackground (value);
+
+ if (!value.IsEmpty())
+ {
+ nsCAutoString bgimg;
+ const nsACString &tmp =
+ NS_ConvertUCS2toUTF8(value);
+
+ nsIURI *uri;
+ doc->GetBaseURL(uri);
+ rv = uri->Resolve
+ (tmp, bgimg);
+ SetStringProperty ("background_image",
+ NS_ConvertUTF8toUCS2(bgimg));
+ if (NS_FAILED (rv))
+ return NS_ERROR_FAILURE;
+ has_background = PR_TRUE;
+ }
+ }
+ }
+
+ if (!has_background)
+ {
+ nsAutoString cssurl;
+ rv = GetCSSBackground (node, cssurl);
+ if (NS_SUCCEEDED (rv))
+ {
+ nsCAutoString bgimg;
+ const nsACString &tmp =
+ NS_ConvertUCS2toUTF8(cssurl);
+
+ nsIURI *uri;
+ doc->GetBaseURL(uri);
+ rv = uri->Resolve
+ (tmp, bgimg);
+ SetStringProperty ("background_image",
+ NS_ConvertUTF8toUCS2(bgimg));
+ if (NS_FAILED (rv))
+ return NS_ERROR_FAILURE;
+ }
+ }
+ }
+
+ nsCOMPtr<nsIDOMNode> parentNode;
+ node->GetParentNode (getter_AddRefs(parentNode));
+ node = parentNode;
+ }
+
+ return NS_OK;
+}
+
+nsresult EventContext::GetCSSBackground (nsIDOMNode *node, nsAutoString& url)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMElementCSSInlineStyle> style;
+ style = do_QueryInterface (node);
+ if (!style) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMCSSStyleDeclaration> decl;
+ result = style->GetStyle (getter_AddRefs(decl));
+ if (NS_FAILED(result)) return NS_ERROR_FAILURE;
+
+ nsAutoString value;
+ NS_NAMED_LITERAL_STRING(prop_bgi, "background-image");
+ decl->GetPropertyValue (prop_bgi, value);
+
+ if (value.IsEmpty())
+ {
+ NS_NAMED_LITERAL_STRING(prop_bg, "background");
+ decl->GetPropertyValue (prop_bg, value);
+ if (value.IsEmpty())
+ {
+ NS_NAMED_LITERAL_STRING(prop_bgr, "background-repeat");
+ decl->GetPropertyValue (prop_bgr, value);
+ if (value.IsEmpty())
+ return NS_ERROR_FAILURE;
+ }
+ }
+
+ PRInt32 start, end;
+ nsAutoString cssurl;
+
+ NS_NAMED_LITERAL_STRING(startsub, "url(");
+ NS_NAMED_LITERAL_STRING(endsub, ")");
+
+ start = value.Find (startsub) + 4;
+ end = value.Find (endsub);
+
+ if (start == -1 || end == -1)
+ return NS_ERROR_FAILURE;
+
+ url.Assign(Substring (value, start, end - start));
+
+ return NS_OK;
+}
+
+nsresult EventContext::GetMouseEventInfo (EphyEmbedEvent *info)
+{
+ nsresult result;
+ DOMTimeStamp ts;
+ nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent*)mEvent;
+
+ aMouseEvent->GetButton ((PRUint16*)&info->mouse_button);
+ aMouseEvent->GetScreenX ((PRInt32*)&info->mouse_x);
+ aMouseEvent->GetScreenY ((PRInt32*)&info->mouse_y);
+
+ aMouseEvent->GetTimeStamp(&ts);
+ info->timestamp = ts;
+
+ /* be sure we are not clicking on the scroolbars */
+
+ nsCOMPtr<nsIDOMNSEvent> nsEvent = do_QueryInterface(aMouseEvent, &result);
+ if (NS_FAILED(result) || !nsEvent) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMEventTarget> OriginalTarget;
+ result = nsEvent->GetOriginalTarget(getter_AddRefs(OriginalTarget));
+ if (NS_FAILED(result) || !OriginalTarget) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMNode> OriginalNode = do_QueryInterface(OriginalTarget);
+ if (!OriginalNode) return NS_ERROR_FAILURE;
+
+ nsAutoString nodename;
+ OriginalNode->GetNodeName(nodename);
+
+ if (nodename.Equals(NS_LITERAL_STRING("xul:scrollbarbutton"),
+ nsCaseInsensitiveStringComparator()) ||
+ nodename.Equals(NS_LITERAL_STRING("xul:thumb"),
+ nsCaseInsensitiveStringComparator()) ||
+ nodename.Equals(NS_LITERAL_STRING("xul:vbox"),
+ nsCaseInsensitiveStringComparator()) ||
+ nodename.Equals(NS_LITERAL_STRING("xul:spacer"),
+ nsCaseInsensitiveStringComparator()) ||
+ nodename.Equals(NS_LITERAL_STRING("xul:slider"),
+ nsCaseInsensitiveStringComparator()))
+ return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMEventTarget> EventTarget;
+ result = aMouseEvent->GetTarget(getter_AddRefs(EventTarget));
+ if (NS_FAILED(result) || !EventTarget) return NS_ERROR_FAILURE;
+
+ result = GetEventContext (EventTarget, info);
+ if (NS_FAILED(result)) return result;
+
+ /* Get the modifier */
+
+ PRBool mod_key;
+
+ info->modifier = 0;
+
+ aMouseEvent->GetAltKey(&mod_key);
+ if (mod_key) info->modifier |= GDK_MOD1_MASK;
+
+ aMouseEvent->GetShiftKey(&mod_key);
+ if (mod_key) info->modifier |= GDK_SHIFT_MASK;
+
+ aMouseEvent->GetMetaKey(&mod_key);
+ if (mod_key) info->modifier |= GDK_Meta_L;
+
+ aMouseEvent->GetCtrlKey(&mod_key);
+ if (mod_key) info->modifier |= GDK_CONTROL_MASK;
+
+ return NS_OK;
+}
+
+nsresult EventContext::IsPageFramed (nsIDOMNode *node, PRBool *Framed)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIDOMDocument> mainDocument;
+ result = mWrapper->GetMainDOMDocument (getter_AddRefs(mainDocument));
+ if (NS_FAILED(result) || !mainDocument) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMDocument> nodeDocument;
+ result = node->GetOwnerDocument (getter_AddRefs(nodeDocument));
+ if (NS_FAILED(result) || !nodeDocument) return NS_ERROR_FAILURE;
+
+ *Framed = (mainDocument != nodeDocument);
+
+ return NS_OK;
+}
+
+nsresult EventContext::GetTargetDocument (nsIDOMDocument **domDoc)
+{
+ if (!mDOMDocument) return NS_ERROR_FAILURE;
+
+ *domDoc = mDOMDocument.get();
+
+ NS_IF_ADDREF(*domDoc);
+
+ return NS_OK;
+}
+
+nsresult EventContext::SetIntProperty (const char *name, int value)
+{
+
+ GValue *val = g_new0 (GValue, 1);
+
+ g_value_init (val, G_TYPE_INT);
+
+ g_value_set_int (val, value);
+
+ ephy_embed_event_set_property (mEmbedEvent,
+ g_strdup (name),
+ val);
+
+ return NS_OK;
+}
+
+nsresult EventContext::SetStringProperty (const char *name, const char *value)
+{
+ GValue *val = g_new0 (GValue, 1);
+
+ g_value_init (val, G_TYPE_STRING);
+
+ g_value_set_string (val, value);
+
+ ephy_embed_event_set_property (mEmbedEvent,
+ g_strdup (name),
+ val);
+
+ return NS_OK;
+}
+
+nsresult EventContext::SetStringProperty (const char *name, const nsAString &value)
+{
+ GValue *val = g_new0 (GValue, 1);;
+ char *tmp;
+
+ tmp = ToNewCString (NS_ConvertUCS2toUTF8(value));
+
+ g_value_init (val, G_TYPE_STRING);
+
+ g_value_set_string (val, tmp);
+
+ ephy_embed_event_set_property (mEmbedEvent,
+ g_strdup (name),
+ val);
+ nsMemory::Free (tmp);
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/EventContext.h b/embed/mozilla/EventContext.h
new file mode 100644
index 000000000..432bd1f53
--- /dev/null
+++ b/embed/mozilla/EventContext.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EVENT_CONTEXT_H
+#define EVENT_CONTEXT_H
+
+#include "nsIDOMMouseEvent.h"
+#include "nsIDOMKeyEvent.h"
+#include "nsIDOMEvent.h"
+#include "nsIDOMNode.h"
+#include "nsString.h"
+#include "nsIDOMHTMLAnchorElement.h"
+#include "nsIDOMNSHTMLElement.h"
+#include "nsIDOMHTMLAreaElement.h"
+#include "nsIDOMHTMLBodyElement.h"
+#include "nsIDOMElementCSSInlineStyle.h"
+#include "nsIDOMCSSStyleDeclaration.h"
+#include "nsIDOMDocument.h"
+#include "EphyWrapper.h"
+
+#include "ephy-embed.h"
+#include "ephy-embed-event.h"
+
+class EventContext
+{
+public:
+ EventContext();
+ ~EventContext();
+
+ nsresult Init (nsIDOMEvent *event, EphyWrapper *wrapper);
+
+ nsresult GetMouseEventInfo (EphyEmbedEvent *info);
+ nsresult GetTargetDocument (nsIDOMDocument **domDoc);
+
+private:
+ nsIDOMEvent *mEvent;
+ EphyWrapper *mWrapper;
+ nsCOMPtr<nsIDOMDocument> mDOMDocument;
+
+ nsresult GetEventContext (nsIDOMEventTarget *EventTarget,
+ EphyEmbedEvent *info);
+ nsresult GetCSSBackground (nsIDOMNode *node, nsAutoString& url);
+ nsresult IsPageFramed (nsIDOMNode *node, PRBool *Framed);
+ nsresult SetIntProperty (const char *name, int value);
+ nsresult SetStringProperty (const char *name, const char *value);
+ nsresult SetStringProperty (const char *name, const nsAString &value);
+ EphyEmbedEvent *mEmbedEvent;
+};
+
+#endif
diff --git a/embed/mozilla/ExternalProtocolService.cpp b/embed/mozilla/ExternalProtocolService.cpp
new file mode 100644
index 000000000..728cd0f5c
--- /dev/null
+++ b/embed/mozilla/ExternalProtocolService.cpp
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+#include <libgnome/gnome-exec.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-url.h>
+
+#include <nsString.h>
+#include <nsXPIDLString.h>
+#include <nsCOMPtr.h>
+#include <nsIURI.h>
+#include <nsIDOMWindow.h>
+#include <nsIWindowWatcher.h>
+#include <nsIServiceManager.h>
+#include <nsXPComFactory.h>
+
+#include "ephy-prefs.h"
+#include "eel-gconf-extensions.h"
+
+#include "ExternalProtocolService.h"
+
+#define WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1"
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1(GExternalProtocolService, nsIExternalProtocolService)
+
+GExternalProtocolService::GExternalProtocolService()
+{
+ NS_INIT_ISUPPORTS();
+ /* member initializers and constructor code */
+}
+
+GExternalProtocolService::~GExternalProtocolService()
+{
+ /* destructor code */
+}
+
+/* boolean externalProtocolHandlerExists (in string aProtocolScheme); */
+NS_IMETHODIMP GExternalProtocolService::
+ ExternalProtocolHandlerExists(const char *aProtocolScheme,
+ PRBool *_retval)
+{
+ /* build the config key */
+ char *key = g_strconcat ("/desktop/gnome/url-handlers/",
+ aProtocolScheme,
+ "/command", NULL);
+
+ char *tmp = eel_gconf_get_string(key);
+ g_free (key);
+
+ *_retval = (tmp != NULL);
+ g_free (tmp);
+
+ return NS_OK;
+}
+
+/* void loadUrl (in nsIURI aURL); */
+NS_IMETHODIMP GExternalProtocolService::LoadUrl(nsIURI *aURL)
+{
+ nsCAutoString cSpec;
+ aURL->GetSpec (cSpec);
+ nsCAutoString cScheme;
+ aURL->GetScheme (cScheme);
+
+ if (cScheme.Equals("http"))
+ {
+ nsresult rv;
+ nsCOMPtr<nsIWindowWatcher> ww;
+ ww = do_GetService(WINDOWWATCHER_CONTRACTID, &rv);
+ if (NS_SUCCEEDED(rv))
+ {
+ nsCOMPtr<nsIDOMWindow> newWin;
+ rv = ww->OpenWindow(nsnull, cSpec.get(),
+ nsnull, nsnull, nsnull,
+ getter_AddRefs(newWin));
+ if (NS_SUCCEEDED(rv)) return NS_OK;
+ }
+ }
+
+ /* build the config key */
+ const nsCAutoString key(NS_LITERAL_CSTRING("/desktop/gnome/url-handlers/") +
+ cScheme + NS_LITERAL_CSTRING("/command"));
+
+ /* find it */
+ char *result = eel_gconf_get_string(key.get());
+ if (result)
+ {
+ gnome_url_show(cSpec.get(), NULL);
+ g_free (result);
+ return NS_OK;
+ }
+
+ /* no luck, so offer the user the option of trying the
+ * default handler -- we don't do this automatically in
+ * case the default handler is erroneously set to epiphany */
+ result = eel_gconf_get_string("/desktop/gnome/url-handlers/unknown/command");
+
+ /* check there is a default */
+ {
+ GtkWidget *dialog;
+
+ /* throw the error */
+ dialog = gtk_message_dialog_new (NULL, (GtkDialogFlags)0,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Galeon cannot handle this protocol,\n"
+ "and no GNOME default handler is set"));
+ gtk_dialog_run (GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+
+ /* don't let mozilla try blindly */
+ return NS_ERROR_FAILURE;
+ }
+ g_free (result);
+
+ /* offer the choice */
+ GtkWidget *dialog = gtk_message_dialog_new (NULL, (GtkDialogFlags)0,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ _("The protocol specified "
+ "is not recognised.\n\n"
+ "Would you like to try "
+ "the GNOME default?"));
+
+ int ret = gtk_dialog_run (GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+
+ if (ret == 0)
+ {
+ gnome_url_show(cSpec.get(), NULL);
+ return NS_OK;
+ }
+ else
+ {
+ return NS_ERROR_FAILURE;
+ }
+
+ return NS_OK;
+}
+
+NS_DEF_FACTORY (GExternalProtocolService, GExternalProtocolService);
+
+/**
+ * NS_NewExternalProtocolServiceFactory:
+ */
+nsresult NS_NewExternalProtocolServiceFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGExternalProtocolServiceFactory *result = new nsGExternalProtocolServiceFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/ExternalProtocolService.h b/embed/mozilla/ExternalProtocolService.h
new file mode 100644
index 000000000..3c49d61e7
--- /dev/null
+++ b/embed/mozilla/ExternalProtocolService.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __ExternalProtocolService_h__
+#define __ExternalProtocolService_h__
+
+#include "nsError.h"
+#include "nsCExternalHandlerService.h"
+#include "nsIExternalProtocolService.h"
+
+class GExternalProtocolService : public nsIExternalProtocolService
+{
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIEXTERNALPROTOCOLSERVICE
+
+ GExternalProtocolService();
+ virtual ~GExternalProtocolService();
+ /* additional members */
+};
+
+#define G_EXTERNALPROTOCOLSERVICE_CID \
+{ /* d2a2f743-f126-4f1f-8921-d4e50490f112 */ \
+ 0xd2a2f743, \
+ 0xf126, \
+ 0x4f1f, \
+ {0x89, 0x21, 0xd4, 0xe5, 0x04, 0x90, 0xf1, 0x12} \
+}
+#define G_EXTERNALPROTOCOLSERVICE_CLASSNAME "Galeon's ExternalProtocolService"
+
+class nsIFactory;
+
+extern nsresult NS_NewExternalProtocolServiceFactory(nsIFactory** aFactory);
+
+#endif // __ExternalProtocolService_h__
diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp
new file mode 100644
index 000000000..baae069ef
--- /dev/null
+++ b/embed/mozilla/FilePicker.cpp
@@ -0,0 +1,505 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/* Things to be aware of:
+ *
+ * This filepicker, like the mozilla one, does not make an attempt
+ * to verify the validity of the initial directory you pass it.
+ * It does check that the user doesn't give it a garbage path
+ * during use, but it is the caller's responsibility to give a
+ * sensible initial path.
+ *
+ * At the current moment, we instantiate the filepicker directly
+ * in our contenthandler where there is path verification code
+ * and else where through our C wrapper, which also does verification.
+ * If, at a future date, you need to instantiate filepicker without
+ * using the C wrapper, please verify the initial path. See
+ * ContentHandler for a way to do this.
+ */
+
+#include "ephy-string.h"
+#include "ephy-gui.h"
+#include "eel-gconf-extensions.h"
+
+#include <gtk/gtkmain.h>
+#include <gtk/gtksignal.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkfilesel.h>
+#include <gtk/gtkhbbox.h>
+#include <gtk/gtkoptionmenu.h>
+#include <gtk/gtkmessagedialog.h>
+#include <libgnome/gnome-i18n.h>
+
+#include "nsIFilePicker.h"
+
+#include "nsCRT.h"
+#include "nsCOMPtr.h"
+#include "nsIFactory.h"
+#include "nsISupportsArray.h"
+#include "nsIServiceManager.h"
+#include "nsXPComFactory.h"
+
+#include "nsString.h"
+#include "nsXPIDLString.h"
+#include "nsIPrefService.h"
+#include "nsIURI.h"
+#include "nsIFileURL.h"
+#include "nsIChannel.h"
+#include "nsIFileChannel.h"
+#include "nsNetCID.h"
+#include "nsILocalFile.h"
+#include "nsIPromptService.h"
+#include "nsReadableUtils.h"
+
+#include <libgnome/gnome-util.h>
+
+#include "FilePicker.h"
+#include "MozillaPrivate.h"
+
+void filePicker_save_content_cb(GtkToggleButton *aButton,
+ GFilePicker *aFilePicker);
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1(GFilePicker, nsIFilePicker)
+
+GFilePicker::GFilePicker(PRBool showContentCheck, FileFormat *fileFormats) :
+ mSaveContent(PR_FALSE)
+{
+ NS_INIT_ISUPPORTS();
+ /* member initializers and constructor code */
+
+ mShowContentCheck = showContentCheck;
+ mFileFormats = fileFormats;
+ mFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ mDisplayDirectory = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ mDisplayDirectory->InitWithNativePath(nsDependentCString(g_get_home_dir()));
+}
+
+GFilePicker::~GFilePicker()
+{
+ /* destructor code */
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin nsIFilePicker impl
+////////////////////////////////////////////////////////////////////////////////
+
+/* void init (in nsIDOMWindowInternal parent, in wstring title, in short mode); */
+NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *aParent,
+ const PRUnichar *aTitle, PRInt16 aMode)
+{
+ mParent = do_QueryInterface(aParent);
+ mParentWidget = MozillaFindGtkParent(mParent);
+ mTitle = NS_ConvertUCS2toUTF8(aTitle);
+ mMode = aMode;
+
+ return NS_OK;
+}
+
+/* void appendFilters (in long filterMask); */
+NS_IMETHODIMP GFilePicker::AppendFilters(PRInt32 aFilterMask)
+{
+ //This function cannot be implemented due to the crippled
+ //nature of GtkFileSelection, but NS_ERROR_NOT_IMPLEMENTED
+ //is interpreted as a terminal error by some callers.
+ return NS_OK;
+}
+
+/* void appendFilter (in wstring title, in wstring filter); */
+NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *aTitle,
+ const PRUnichar *aFilter)
+{
+ //GtkFileSelection is crippled, so we can't provide a short-list
+ //of filters to choose from. We provide minimal functionality
+ //by using the most recent AppendFilter call as the active filter.
+ mFilter = NS_ConvertUCS2toUTF8(aFilter);
+ return NS_OK;
+}
+
+/* attribute long filterIndex; */
+NS_IMETHODIMP GFilePicker::GetFilterIndex(PRInt32 *aFilterIndex)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP GFilePicker::SetFilterIndex(PRInt32 aFilterIndex)
+{
+ return NS_OK;
+}
+
+/* attribute wstring defaultString; */
+NS_IMETHODIMP GFilePicker::GetDefaultString(PRUnichar * *aDefaultString)
+{
+ *aDefaultString = ToNewUnicode(NS_ConvertUTF8toUCS2(mDefaultString));
+ return NS_OK;
+}
+NS_IMETHODIMP GFilePicker::SetDefaultString(const PRUnichar *aDefaultString)
+{
+ if (aDefaultString)
+ mDefaultString = NS_ConvertUCS2toUTF8(aDefaultString);
+ else
+ mDefaultString = "";
+ return NS_OK;
+}
+
+/* attribute wstring defaultExtension; */
+// Again, due to the crippled file selector, we can't really
+// do anything here.
+NS_IMETHODIMP GFilePicker::GetDefaultExtension(PRUnichar * *aDefaultExtension)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP GFilePicker::SetDefaultExtension(const PRUnichar *aDefaultExtension)
+{
+ return NS_OK;
+}
+
+/* attribute nsILocalFile displayDirectory; */
+NS_IMETHODIMP GFilePicker::GetDisplayDirectory(nsILocalFile * *aDisplayDirectory)
+{
+ NS_IF_ADDREF(*aDisplayDirectory = mDisplayDirectory);
+ return NS_OK;
+}
+NS_IMETHODIMP GFilePicker::SetDisplayDirectory(nsILocalFile * aDisplayDirectory)
+{
+ mDisplayDirectory = aDisplayDirectory;
+ return NS_OK;
+}
+
+/* readonly attribute nsILocalFile file; */
+NS_IMETHODIMP GFilePicker::GetFile(nsILocalFile * *aFile)
+{
+ NS_IF_ADDREF(*aFile = mFile);
+ return NS_OK;
+}
+
+/* readonly attribute nsIFileURL fileURL; */
+NS_IMETHODIMP GFilePicker::GetFileURL(nsIFileURL * *aFileURL)
+{
+ nsCOMPtr<nsIFileURL> fileURL =
+ do_CreateInstance(NS_STANDARDURL_CONTRACTID);
+ fileURL->SetFile(mFile);
+ NS_IF_ADDREF(*aFileURL = fileURL);
+ return NS_OK;
+}
+
+/* readonly attribute nsISimpleEnumerator files; */
+NS_IMETHODIMP GFilePicker::GetFiles(nsISimpleEnumerator * *aFiles)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* short show (); */
+NS_IMETHODIMP GFilePicker::Show(PRInt16 *_retval)
+{
+ mFileSelector = gtk_file_selection_new(mTitle.get());
+
+ nsCAutoString cFileName;
+ if(mMode == nsIFilePicker::modeGetFolder)
+ cFileName.Assign("");
+ else
+ cFileName = mDefaultString;
+
+ nsCAutoString cDirName;
+ mDisplayDirectory->GetNativePath(cDirName);
+
+ nsCAutoString cFullPath;
+ cFullPath.Assign(cDirName + NS_LITERAL_CSTRING("/") + cFileName);
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(mFileSelector),
+ cFullPath.get());
+
+ if (!mFilter.IsEmpty())
+ {
+ gtk_file_selection_complete(GTK_FILE_SELECTION(mFileSelector),
+ mFilter.get());
+ }
+
+ if (mParentWidget)
+ gtk_window_set_transient_for(GTK_WINDOW(mFileSelector),
+ GTK_WINDOW(mParentWidget));
+
+ if (mShowContentCheck)
+ {
+ GtkWidget *bbox = gtk_hbutton_box_new ();
+ gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox),
+ GTK_BUTTONBOX_END);
+ gtk_box_set_spacing(GTK_BOX(bbox), 0);
+ gtk_box_pack_end(GTK_BOX(GTK_FILE_SELECTION(mFileSelector)->action_area),
+ bbox, TRUE, TRUE, 0);
+
+ GtkWidget *saveContent =
+ gtk_check_button_new_with_label(_("Save with content"));
+ g_signal_connect(G_OBJECT(saveContent),
+ "clicked",
+ G_CALLBACK(filePicker_save_content_cb),
+ (gpointer)this);
+
+ gtk_box_pack_start(GTK_BOX(bbox), saveContent,
+ FALSE, FALSE, 0);
+
+ gtk_widget_show_all(bbox);
+ }
+
+ if (mFileFormats)
+ {
+ mFormatChooser = gtk_option_menu_new();
+ GtkMenu *options = GTK_MENU(gtk_menu_new());
+
+ FileFormat *current = mFileFormats;
+ while (current->description != NULL)
+ {
+ /* FIXME: the label should include the extensions too */
+ gchar *label = current->description;
+ GtkWidget *item = gtk_menu_item_new_with_label(label);
+ gtk_widget_show(item);
+ gtk_menu_shell_append(GTK_MENU_SHELL(options), item);
+ current++;
+ }
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(mFormatChooser),
+ GTK_WIDGET(options));
+ gtk_widget_show(mFormatChooser);
+ gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION (mFileSelector)->action_area),
+ mFormatChooser,
+ FALSE, TRUE, 0);
+ }
+ else
+ {
+ mFormatChooser = NULL;
+ }
+
+ if (mMode == nsIFilePicker::modeGetFolder)
+ {
+ gtk_widget_set_sensitive(GTK_FILE_SELECTION(mFileSelector)
+ ->file_list, FALSE);
+ }
+
+ gtk_window_set_modal(GTK_WINDOW(mFileSelector), TRUE);
+
+ gint retVal = gtk_dialog_run(GTK_DIALOG(mFileSelector));
+
+ if (retVal == GTK_RESPONSE_OK)
+ {
+ HandleFilePickerResult(_retval);
+ }
+ else
+ {
+ *_retval = returnCancel;
+ }
+
+ gtk_widget_hide(mFileSelector);
+ gtk_widget_destroy(mFileSelector);
+
+ return NS_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin local public methods impl
+////////////////////////////////////////////////////////////////////////////////
+
+NS_METHOD GFilePicker::InitWithGtkWidget (GtkWidget *aParentWidget,
+ const char *aTitle, PRInt16 aMode)
+{
+ mParentWidget = aParentWidget;
+
+ mTitle = nsDependentCString(aTitle);
+
+ mMode = mMode;
+
+ mFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+
+ return NS_OK;
+}
+
+NS_METHOD GFilePicker::SanityCheck (PRBool *retIsSane)
+{
+ *retIsSane = PR_TRUE;
+
+ PRBool dirExists, fileExists = PR_TRUE;
+
+ if (mDisplayDirectory)
+ {
+ mDisplayDirectory->Exists (&dirExists);
+ }
+ else
+ {
+ dirExists = PR_FALSE;
+ }
+
+ if (mMode == nsIFilePicker::modeOpen)
+ {
+ mFile->Exists (&fileExists);
+ }
+
+ if (!dirExists || !fileExists)
+ {
+ GtkWidget *errorDialog = gtk_message_dialog_new (
+ NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("The specified path does not exist."));
+
+ if (mParentWidget)
+ gtk_window_set_transient_for(GTK_WINDOW(errorDialog),
+ GTK_WINDOW(mFileSelector));
+
+ gtk_window_set_modal (GTK_WINDOW(errorDialog), TRUE);
+ gtk_dialog_run (GTK_DIALOG(errorDialog));
+ *retIsSane = PR_FALSE;
+ return NS_OK;
+ }
+
+ PRBool correctType;
+ char *errorText;
+ if (mMode == nsIFilePicker::modeGetFolder)
+ {
+ mDisplayDirectory->IsDirectory (&correctType);
+ errorText = g_strdup (_("A file was selected when a "
+ "folder was expected."));
+ }
+ else
+ {
+ mFile->IsFile (&correctType);
+ errorText = g_strdup (_("A folder was selected when a "
+ "file was expected."));
+ }
+
+ if(!correctType)
+ {
+ GtkWidget *errorDialog = gtk_message_dialog_new (
+ NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ errorText);
+
+ if (mParentWidget)
+ gtk_window_set_transient_for(GTK_WINDOW(errorDialog),
+ GTK_WINDOW(mFileSelector));
+
+ gtk_window_set_modal (GTK_WINDOW(errorDialog), TRUE);
+ gtk_dialog_run (GTK_DIALOG(errorDialog));
+ *retIsSane = PR_FALSE;
+ }
+ g_free (errorText);
+
+ return NS_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin local private methods impl
+////////////////////////////////////////////////////////////////////////////////
+
+NS_METHOD GFilePicker::HandleFilePickerResult(PRInt16 *retval)
+{
+ *retval = returnCancel;
+ nsresult rv;
+
+ const char *fileName = gtk_file_selection_get_filename(GTK_FILE_SELECTION(mFileSelector));
+
+ if (!fileName || strlen(fileName) == 0) return NS_ERROR_FAILURE;
+
+ if (mMode == nsIFilePicker::modeSave)
+ {
+ if (!ephy_gui_confirm_overwrite_file (mFileSelector,
+ fileName))
+ {
+ return NS_OK;
+ }
+ }
+
+ const nsACString &cFileName = nsDependentCString(fileName);
+ mFile->InitWithNativePath(cFileName);
+
+ if (mMode == nsIFilePicker::modeGetFolder)
+ {
+ mDisplayDirectory->InitWithNativePath(cFileName);
+ mDefaultString = "";
+ }
+ else
+ {
+ nsCOMPtr<nsIFile> directory;
+ mFile->GetParent(getter_AddRefs(directory));
+ mDisplayDirectory = do_QueryInterface(directory);
+ mFile->GetNativeLeafName(mDefaultString);
+ }
+
+ PRBool passesSanityCheck;
+ rv = SanityCheck(&passesSanityCheck);
+ if (NS_SUCCEEDED(rv) && !passesSanityCheck) return NS_ERROR_FAILURE;
+
+ if (mFormatChooser)
+ {
+ gint i = 0;
+ GtkWidget *menu = gtk_option_menu_get_menu
+ (GTK_OPTION_MENU(mFormatChooser));
+ GList *iterator = GTK_MENU_SHELL(menu)->children;
+ GtkWidget *selected = gtk_menu_get_active (GTK_MENU(menu));
+
+ while (iterator)
+ {
+ if (iterator->data == selected)
+ {
+ mSelectedFileFormat = i;
+ break;
+ }
+ iterator = iterator->next;
+ i++;
+ }
+ }
+
+ *retval = mSaveContent ? returnOKSaveContent : returnOK;
+ return NS_OK;
+}
+
+//------------------------------------------------------------------------------
+
+NS_DEF_FACTORY (GFilePicker, GFilePicker);
+
+/**
+ * NS_NewFilePickerFactory:
+ */
+nsresult NS_NewFilePickerFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGFilePickerFactory *result = new nsGFilePickerFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// begin FileSelector callbacks.
+////////////////////////////////////////////////////////////////////////////////
+
+void filePicker_save_content_cb(GtkToggleButton *aButton,
+ GFilePicker *aFilePicker)
+{
+ aFilePicker->mSaveContent = gtk_toggle_button_get_active (aButton) ?
+ PR_TRUE : PR_FALSE;
+}
diff --git a/embed/mozilla/FilePicker.h b/embed/mozilla/FilePicker.h
new file mode 100644
index 000000000..93c025637
--- /dev/null
+++ b/embed/mozilla/FilePicker.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef FILE_PICKER_H
+#define FILE_PICKER_H
+
+#include "nsIFilePicker.h"
+#include "nsError.h"
+#include "nsIDOMWindow.h"
+#include "nsIDOMWindowInternal.h"
+#include "nsCOMPtr.h"
+#include "nsString.h"
+#include "nsILocalFile.h"
+#include <gtk/gtktogglebutton.h>
+#include "ephy-embed-shell.h"
+
+#define G_FILEPICKER_CID \
+{ /* 3636dc79-0b42-4bad-8a3f-ae15d3671d17 */ \
+ 0x3636dc79, \
+ 0x0b42, \
+ 0x4bad, \
+ {0x8a, 0x3f, 0xae, 0x15, 0xd3, 0x67, 0x1d, 0x17} \
+}
+
+#define G_FILEPICKER_CONTRACTID "@mozilla.org/filepicker;1"
+#define G_FILEPICKER_CLASSNAME "Galeon's File Picker Implementation"
+
+class nsIFactory;
+
+extern nsresult NS_NewFilePickerFactory(nsIFactory** aFactory);
+
+/* Header file */
+class GFilePicker : public nsIFilePicker
+{
+ friend void filePicker_save_content_cb(GtkToggleButton *aButton,
+ GFilePicker *aFilePicker);
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIFILEPICKER
+ enum { returnOK = nsIFilePicker::returnOK,
+ returnCancel = nsIFilePicker::returnCancel,
+ returnReplace = nsIFilePicker::returnReplace,
+ returnOKSaveContent = 256 };
+
+ GFilePicker(PRBool aShowContentCheck = PR_FALSE, FileFormat *aFileFormats = NULL);
+ virtual ~GFilePicker();
+
+ /* additional members */
+ NS_METHOD InitWithGtkWidget(GtkWidget *aParentWidget,
+ const char *aTitle, PRInt16 aMode);
+ NS_METHOD SanityCheck(PRBool *retIsSane);
+
+ PRInt16 mSelectedFileFormat;
+
+ private:
+ NS_METHOD HandleFilePickerResult(PRInt16 *retval);
+
+ nsCOMPtr<nsIDOMWindow> mParent;
+
+ nsCString mTitle;
+ nsCString mFilter;
+ nsCString mDefaultString;
+
+ nsCOMPtr<nsILocalFile> mFile;
+ nsCOMPtr<nsILocalFile> mDisplayDirectory;
+
+ PRInt16 mMode;
+
+ PRBool mShowContentCheck;
+ PRBool mSaveContent;
+
+ GtkWidget *mParentWidget;
+ GtkWidget *mFileSelector;
+ GtkWidget *mFormatChooser;
+
+ FileFormat *mFileFormats;
+};
+
+#endif
diff --git a/embed/mozilla/FtpProtocolHandler.cpp b/embed/mozilla/FtpProtocolHandler.cpp
new file mode 100644
index 000000000..a9b299095
--- /dev/null
+++ b/embed/mozilla/FtpProtocolHandler.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "nsIFactory.h"
+#include "nsXPComFactory.h"
+
+#include "BaseProtocolContentHandler.h"
+
+class GFtpProtocolHandler : public GBaseProtocolContentHandler
+{
+ public:
+ NS_DECL_ISUPPORTS
+ GFtpProtocolHandler() : GBaseProtocolContentHandler("ftp")
+ {NS_INIT_ISUPPORTS();};
+ virtual ~GFtpProtocolHandler() {};
+ /* additional members */
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS2 (GFtpProtocolHandler, nsIProtocolHandler, nsIContentHandler)
+
+NS_DEF_FACTORY (GFtpProtocolHandler, GFtpProtocolHandler);
+
+/**
+ * NS_NewFtpHandlerFactory:
+ */
+nsresult NS_NewFtpHandlerFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGFtpProtocolHandlerFactory *result =
+ new nsGFtpProtocolHandlerFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/FtpProtocolHandler.h b/embed/mozilla/FtpProtocolHandler.h
new file mode 100644
index 000000000..d305501d5
--- /dev/null
+++ b/embed/mozilla/FtpProtocolHandler.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __FtpProtocolHandler_h__
+#define __FtpProtocolHandler_h__
+
+#include "nsError.h"
+#include "nsIProtocolHandler.h"
+#include "nsCURILoader.h"
+
+#define G_FTP_PROTOCOL_CID \
+{ /* 5a48bdf4-a422-4eb4-b073-0fc3bee8e670 */ \
+ 0x5a48bdf4, \
+ 0xa422, \
+ 0x4eb4, \
+ {0xb0, 0x73, 0x0f, 0xc3, 0xbe, 0xe8, 0xe6, 0x70} \
+}
+#define G_FTP_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp"
+#define G_FTP_PROTOCOL_CLASSNAME "Galeon's FTP Protocol Handler"
+#define G_FTP_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \
+ "application-x-gnome-ftp"
+#define G_FTP_CONTENT_CLASSNAME "Galeon's FTP Content Handler"
+
+#define NS_FTPPROTOCOLHANDLER_CID \
+{ \
+ 0x25029490, \
+ 0xf132, \
+ 0x11d2, \
+ {0x95, 0x88, 0x0, 0x80, 0x5f, 0x36, 0x9f, 0x95} \
+}
+#define NS_FTPPROTOCOLHANDLER_CLASSNAME "The FTP Protocol Handler"
+
+class nsIFactory;
+
+extern nsresult NS_NewFtpHandlerFactory(nsIFactory** aFactory);
+
+#endif // __FtpProtocolHandler_h__
diff --git a/embed/mozilla/GlobalHistory.cpp b/embed/mozilla/GlobalHistory.cpp
new file mode 100644
index 000000000..a559dbc10
--- /dev/null
+++ b/embed/mozilla/GlobalHistory.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "mozilla-embed-shell.h"
+
+#include "nsCOMPtr.h"
+#include "nsISupportsArray.h"
+#include "nsIFactory.h"
+#include "nsIServiceManager.h"
+#include "nsXPComFactory.h"
+#include "nsString.h"
+#include "nsReadableUtils.h"
+#include "nsIGlobalHistory.h"
+#include "nsIBrowserHistory.h"
+#include "nsIRequestObserver.h"
+
+/**
+ * class GlobalHistory:
+ *
+ */
+class MozGlobalHistory: public nsIGlobalHistory,
+ public nsIBrowserHistory
+{
+ public:
+ MozGlobalHistory ();
+ virtual ~MozGlobalHistory();
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIGLOBALHISTORY
+ NS_DECL_NSIBROWSERHISTORY
+
+ private:
+ EphyHistory *mGlobalHistory;
+};
+
+NS_IMPL_ADDREF(MozGlobalHistory)
+NS_IMPL_RELEASE(MozGlobalHistory)
+NS_INTERFACE_MAP_BEGIN(MozGlobalHistory)
+ NS_INTERFACE_MAP_ENTRY(nsIGlobalHistory)
+ NS_INTERFACE_MAP_ENTRY(nsIBrowserHistory)
+NS_INTERFACE_MAP_END
+
+MozGlobalHistory::MozGlobalHistory ()
+{
+ NS_INIT_ISUPPORTS();
+
+ mGlobalHistory = ephy_embed_shell_get_global_history (embed_shell);
+}
+
+MozGlobalHistory::~MozGlobalHistory ()
+{
+}
+
+/* void addPage (in string aURL); */
+NS_IMETHODIMP MozGlobalHistory::AddPage (const char *aURL)
+{
+ ephy_history_add_page (mGlobalHistory, aURL);
+
+ return NS_OK;
+}
+
+/* boolean isVisited (in string aURL); */
+NS_IMETHODIMP MozGlobalHistory::IsVisited (const char *aURL, PRBool *_retval)
+{
+ *_retval = ephy_history_is_page_visited (mGlobalHistory, aURL);
+
+ return NS_OK;
+}
+
+/* void setPageTitle (in string aURL, in wstring aTitle); */
+NS_IMETHODIMP MozGlobalHistory::SetPageTitle (const char *aURL,
+ const PRUnichar *aTitle)
+{
+ const nsACString &title = NS_ConvertUCS2toUTF8 (aTitle);
+
+ ephy_history_set_page_title (mGlobalHistory, aURL, PromiseFlatCString(title).get());
+
+ /* done */
+ return NS_OK;
+}
+
+/* void removePage (in string aURL); */
+NS_IMETHODIMP MozGlobalHistory::RemovePage(const char *aURL)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void removePagesFromHost (in string aHost, in boolean aEntireDomain); */
+NS_IMETHODIMP MozGlobalHistory::RemovePagesFromHost(const char *aHost,
+ PRBool aEntireDomain)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void removeAllPages (); */
+NS_IMETHODIMP MozGlobalHistory::RemoveAllPages()
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute string lastPageVisited; */
+NS_IMETHODIMP MozGlobalHistory::GetLastPageVisited(char **aLastPageVisited)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP MozGlobalHistory::HidePage(const char *url)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+
+}
+
+/* readonly attribute PRUint32 count; */
+NS_IMETHODIMP MozGlobalHistory::GetCount(PRUint32 *aCount)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void startBatchUpdate (); */
+NS_IMETHODIMP MozGlobalHistory::StartBatchUpdate()
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void endBatchUpdate (); */
+NS_IMETHODIMP MozGlobalHistory::EndBatchUpdate()
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void markPageAsTyped (in string url); */
+NS_IMETHODIMP MozGlobalHistory::MarkPageAsTyped(const char *url)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_DEF_FACTORY (MozGlobalHistory, MozGlobalHistory);
+
+nsresult NS_NewGlobalHistoryFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsMozGlobalHistoryFactory *result = new nsMozGlobalHistoryFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/GlobalHistory.h b/embed/mozilla/GlobalHistory.h
new file mode 100644
index 000000000..5b2e615a1
--- /dev/null
+++ b/embed/mozilla/GlobalHistory.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GlobalHistory_h
+#define __GlobalHistory_h
+
+#include "nsError.h"
+
+#define GALEON_GLOBALHISTORY_CID \
+ { 0xbe0c42c1, 0x39d4, 0x4271, { 0xb7, 0x9e, 0xf7, 0xaa, 0x49, 0xeb, 0x6a, 0x15}}
+
+class nsIFactory;
+
+extern nsresult NS_NewGlobalHistoryFactory(nsIFactory** aFactory);
+
+#endif
diff --git a/embed/mozilla/IRCProtocolHandler.cpp b/embed/mozilla/IRCProtocolHandler.cpp
new file mode 100644
index 000000000..b1c4d7f68
--- /dev/null
+++ b/embed/mozilla/IRCProtocolHandler.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "nsIFactory.h"
+#include "nsXPComFactory.h"
+
+#include "BaseProtocolContentHandler.h"
+
+class GIRCProtocolHandler : public GBaseProtocolContentHandler
+{
+ public:
+ NS_DECL_ISUPPORTS
+ GIRCProtocolHandler() : GBaseProtocolContentHandler("irc")
+ {NS_INIT_ISUPPORTS();};
+ virtual ~GIRCProtocolHandler() {};
+ /* additional members */
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS2 (GIRCProtocolHandler, nsIProtocolHandler, nsIContentHandler)
+
+NS_DEF_FACTORY (GIRCProtocolHandler, GIRCProtocolHandler);
+
+/**
+ * NS_NewIRCHandlerFactory:
+ */
+nsresult NS_NewIRCHandlerFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGIRCProtocolHandlerFactory *result =
+ new nsGIRCProtocolHandlerFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/IRCProtocolHandler.h b/embed/mozilla/IRCProtocolHandler.h
new file mode 100644
index 000000000..149daa121
--- /dev/null
+++ b/embed/mozilla/IRCProtocolHandler.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __IRCProtocolHandler_h__
+#define __IRCProtocolHandler_h__
+
+#include "nsError.h"
+#include "nsIProtocolHandler.h"
+#include "nsCURILoader.h"
+
+#define G_IRC_PROTOCOL_CID \
+{ /* aabe33d3-7455-4d8f-87e7-43e4541ace4e */ \
+ 0xaabe33d3, \
+ 0x7455, \
+ 0x4d8f, \
+ {0x87, 0xe7, 0x43, 0xe4, 0x54, 0x1a, 0xce, 0x4e} \
+}
+#define G_IRC_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "irc"
+#define G_IRC_PROTOCOL_CLASSNAME "Galeon's irc Protocol Handler"
+#define G_IRC_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \
+ "application-x-gnome-irc"
+#define G_IRC_CONTENT_CLASSNAME "Galeon's irc Content Handler"
+
+class nsIFactory;
+
+extern nsresult NS_NewIRCHandlerFactory(nsIFactory** aFactory);
+
+#endif // __IRCProtocolHandler_h__
diff --git a/embed/mozilla/MailtoProtocolHandler.cpp b/embed/mozilla/MailtoProtocolHandler.cpp
new file mode 100644
index 000000000..946f14aff
--- /dev/null
+++ b/embed/mozilla/MailtoProtocolHandler.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "nsIFactory.h"
+#include "nsXPComFactory.h"
+#include "nsString.h"
+#include "nsIURI.h"
+#include "nsNetUtil.h"
+#include "nsIExternalProtocolService.h"
+#include "nsCExternalHandlerService.h"
+#include "nsCRT.h"
+
+#include "BaseProtocolContentHandler.h"
+
+class GMailtoProtocolHandler : public GBaseProtocolContentHandler
+{
+ public:
+ NS_DECL_ISUPPORTS
+ GMailtoProtocolHandler() : GBaseProtocolContentHandler("mailto")
+ {NS_INIT_ISUPPORTS();};
+ virtual ~GMailtoProtocolHandler() {};
+ private:
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS2 (GMailtoProtocolHandler, nsIProtocolHandler, nsIContentHandler)
+
+NS_DEF_FACTORY (GMailtoProtocolHandler, GMailtoProtocolHandler);
+
+/**
+ * NS_NewMailtoHandlerFactory:
+ */
+nsresult NS_NewMailtoHandlerFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGMailtoProtocolHandlerFactory *result =
+ new nsGMailtoProtocolHandlerFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/MailtoProtocolHandler.h b/embed/mozilla/MailtoProtocolHandler.h
new file mode 100644
index 000000000..961f42c42
--- /dev/null
+++ b/embed/mozilla/MailtoProtocolHandler.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __MailtoProtocolHandler_h__
+#define __MailtoProtocolHandler_h__
+
+#include "nsError.h"
+#include "nsIProtocolHandler.h"
+#include "nsCURILoader.h"
+
+#define G_MAILTO_PROTOCOL_CID \
+{ /* aabe33d3-7455-4d8f-87e7-43e4541ace4d */ \
+ 0xaabe33d3, \
+ 0x7455, \
+ 0x4d8f, \
+ {0x87, 0xe7, 0x43, 0xe4, 0x54, 0x1a, 0xce, 0x4d} \
+}
+#define G_MAILTO_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "mailto"
+#define G_MAILTO_PROTOCOL_CLASSNAME "Galeon's mailto Protocol Handler"
+#define G_MAILTO_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \
+ "application-x-gnome-mailto"
+#define G_MAILTO_CONTENT_CLASSNAME "Galeon's mailto Content Handler"
+
+class nsIFactory;
+
+extern nsresult NS_NewMailtoHandlerFactory(nsIFactory** aFactory);
+
+#endif // __MailtoProtocolHandler_h__
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
new file mode 100644
index 000000000..ef7ef9dfa
--- /dev/null
+++ b/embed/mozilla/Makefile.am
@@ -0,0 +1,108 @@
+#MOZILLA_ACDEFINES = -include $(MOZILLA_INCLUDE_ROOT)/mozilla-config.h
+MOZILLA_ACDEFINES=-DNEW_H=\<new\>
+
+INCLUDES = \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/embed \
+ -I$(top_srcdir) \
+ $(WARN_CFLAGS) \
+ $(MOZILLA_COMPONENT_CFLAGS) \
+ -I$(MOZILLA_INCLUDE_ROOT) \
+ -I$(MOZILLA_INCLUDE_ROOT)/appcomps \
+ -I$(MOZILLA_INCLUDE_ROOT)/content \
+ -I$(MOZILLA_INCLUDE_ROOT)/cookie \
+ -I$(MOZILLA_INCLUDE_ROOT)/docshell \
+ -I$(MOZILLA_INCLUDE_ROOT)/dom \
+ -I$(MOZILLA_INCLUDE_ROOT)/exthandler \
+ -I$(MOZILLA_INCLUDE_ROOT)/find \
+ -I$(MOZILLA_INCLUDE_ROOT)/gfx \
+ -I$(MOZILLA_INCLUDE_ROOT)/helperAppDlg \
+ -I$(MOZILLA_INCLUDE_ROOT)/java \
+ -I$(MOZILLA_INCLUDE_ROOT)/jsconsole \
+ -I$(MOZILLA_INCLUDE_ROOT)/layout \
+ -I$(MOZILLA_INCLUDE_ROOT)/mimetype \
+ -I$(MOZILLA_INCLUDE_ROOT)/mozxfer \
+ -I$(MOZILLA_INCLUDE_ROOT)/necko \
+ -I$(MOZILLA_INCLUDE_ROOT)/necko2 \
+ -I$(MOZILLA_INCLUDE_ROOT)/nkcache \
+ -I$(MOZILLA_INCLUDE_ROOT)/oji \
+ -I$(MOZILLA_INCLUDE_ROOT)/pref \
+ -I$(MOZILLA_INCLUDE_ROOT)/progressDlg \
+ -I$(MOZILLA_INCLUDE_ROOT)/sidebar \
+ -I$(MOZILLA_INCLUDE_ROOT)/shistory \
+ -I$(MOZILLA_INCLUDE_ROOT)/uconv \
+ -I$(MOZILLA_INCLUDE_ROOT)/uriloader \
+ -I$(MOZILLA_INCLUDE_ROOT)/unicharutil \
+ -I$(MOZILLA_INCLUDE_ROOT)/wallet \
+ -I$(MOZILLA_INCLUDE_ROOT)/webbrowserpersist \
+ -I$(MOZILLA_INCLUDE_ROOT)/webbrwsr \
+ -I$(MOZILLA_INCLUDE_ROOT)/webshell \
+ -I$(MOZILLA_INCLUDE_ROOT)/widget \
+ -I$(MOZILLA_INCLUDE_ROOT)/windowwatcher \
+ -I$(MOZILLA_INCLUDE_ROOT)/typeaheadfind \
+ $(GCONF_CFLAGS) \
+ $(EPIPHANY_DEPENDENCY_CFLAGS) \
+ -DLIB_DIR=\"$(pkglibdir)\" \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGNOME_DISABLE_DEPRECATED \
+ -DSHARE_DIR=\"$(pkgdatadir)\" \
+ $(MOZILLA_ACDEFINES)
+
+noinst_LTLIBRARIES = libephymozillaembed.la
+
+libephymozillaembed_la_SOURCES = \
+ mozilla-embed.cpp \
+ mozilla-embed.h \
+ mozilla-embed-shell.cpp \
+ mozilla-embed-shell.h \
+ mozilla-embed-persist.cpp \
+ mozilla-embed-persist.h \
+ mozilla-prefs.cpp \
+ mozilla-prefs.h \
+ mozilla-notifiers.cpp \
+ mozilla-notifiers.h \
+ mozilla-i18n.c \
+ mozilla-i18n.h \
+ BaseProtocolHandler.cpp \
+ BaseProtocolHandler.h \
+ BaseProtocolContentHandler.cpp \
+ BaseProtocolContentHandler.h \
+ ContentHandler.cpp \
+ ContentHandler.h \
+ EventContext.cpp \
+ EventContext.h \
+ FilePicker.cpp \
+ FilePicker.h \
+ FtpProtocolHandler.cpp \
+ FtpProtocolHandler.h \
+ EphyWrapper.cpp \
+ EphyWrapper.h \
+ GlobalHistory.cpp \
+ GlobalHistory.h \
+ IRCProtocolHandler.cpp \
+ IRCProtocolHandler.h \
+ MailtoProtocolHandler.cpp \
+ MailtoProtocolHandler.h \
+ MozillaPrivate.cpp \
+ MozillaPrivate.h \
+ MozRegisterComponents.cpp \
+ MozRegisterComponents.h \
+ PrintingPromptService.cpp \
+ PrintingPromptService.h \
+ PrintProgressListener.cpp \
+ PrintProgressListener.h \
+ PromptService.cpp \
+ PromptService.h \
+ ProgressListener.cpp \
+ ProgressListener.h \
+ nsUnicharUtils.cpp \
+ nsUnicharUtils.h \
+ ExternalProtocolService.cpp \
+ ExternalProtocolService.h \
+ StartHereProtocolHandler.cpp \
+ StartHereProtocolHandler.h \
+ EphyEventListener.cpp \
+ EphyEventListener.h
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
new file mode 100644
index 000000000..3c5e64be7
--- /dev/null
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "StartHereProtocolHandler.h"
+#include "ContentHandler.h"
+#include "ExternalProtocolService.h"
+#include "FilePicker.h"
+#include "FtpProtocolHandler.h"
+#include "IRCProtocolHandler.h"
+#include "MailtoProtocolHandler.h"
+#include "PromptService.h"
+#include "PrintingPromptService.h"
+#include "ProgressListener.h"
+
+#include <nsIFactory.h>
+#include <nsIComponentManager.h>
+#include <nsCOMPtr.h>
+#include <nsILocalFile.h>
+
+#include <glib.h>
+
+static NS_DEFINE_CID(kContentHandlerCID, G_CONTENTHANDLER_CID);
+static NS_DEFINE_CID(kProtocolServiceCID, G_EXTERNALPROTOCOLSERVICE_CID);
+static NS_DEFINE_CID(kFilePickerCID, G_FILEPICKER_CID);
+static NS_DEFINE_CID(kStartHereProcotolHandlerCID, G_START_HERE_PROTOCOLHANDLER_CID);
+static NS_DEFINE_CID(knsFtpProtocolHandlerCID, NS_FTPPROTOCOLHANDLER_CID);
+static NS_DEFINE_CID(kFtpHandlerCID, G_FTP_PROTOCOL_CID);
+static NS_DEFINE_CID(kIRCHandlerCID, G_IRC_PROTOCOL_CID);
+static NS_DEFINE_CID(kMailtoHandlerCID, G_MAILTO_PROTOCOL_CID);
+static NS_DEFINE_CID(kPromptServiceCID, G_PROMPTSERVICE_CID);
+static NS_DEFINE_CID(kPrintingPromptServiceCID, G_PRINTINGPROMPTSERVICE_CID);
+static NS_DEFINE_CID(kProgressDialogCID, G_PROGRESSDIALOG_CID);
+
+//RegisterFactory is local
+NS_METHOD RegisterFactory (nsresult (aFactoryFunc)(nsIFactory** aFactory),
+ const nsCID & aClass, const char *aClassName,
+ const char *aContractID, PRBool aReplace);
+
+NS_METHOD RegisterComponent (const nsCID & aClass, const char *aClassName,
+ const char *aContractID, const char *aDLLPath,
+ PRBool aReplace);
+
+//Annoying globals to track the mozilla ftp handler so it can be restored.
+static PRBool ftpRegistered = PR_FALSE;
+static nsCOMPtr<nsIFactory> nsFtpFactory;
+
+/* FIXME why we need to use "C" here ???? */
+
+extern "C" gboolean
+mozilla_register_components (void)
+{
+ gboolean ret = TRUE;
+ nsresult rv;
+
+ rv = RegisterFactory (NS_NewProgressListenerFactory, kProgressDialogCID,
+ G_PROGRESSDIALOG_CLASSNAME,
+ NS_DOWNLOAD_CONTRACTID, PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewContentHandlerFactory, kContentHandlerCID,
+ NS_IHELPERAPPLAUNCHERDLG_CLASSNAME,
+ NS_IHELPERAPPLAUNCHERDLG_CONTRACTID, PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewExternalProtocolServiceFactory,
+ kProtocolServiceCID,
+ G_EXTERNALPROTOCOLSERVICE_CLASSNAME,
+ NS_EXTERNALPROTOCOLSERVICE_CONTRACTID,
+ PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewFilePickerFactory, kFilePickerCID,
+ G_FILEPICKER_CLASSNAME, G_FILEPICKER_CONTRACTID,
+ PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewStartHereHandlerFactory,
+ kStartHereProcotolHandlerCID,
+ G_START_HERE_PROTOCOLHANDLER_CLASSNAME,
+ G_START_HERE_PROTOCOLHANDLER_CONTRACTID,
+ PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewFtpHandlerFactory, kFtpHandlerCID,
+ G_FTP_CONTENT_CLASSNAME, G_FTP_CONTENT_CONTRACTID,
+ PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewIRCHandlerFactory, kIRCHandlerCID,
+ G_IRC_PROTOCOL_CLASSNAME,
+ G_IRC_PROTOCOL_CONTRACTID, PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewIRCHandlerFactory, kIRCHandlerCID,
+ G_IRC_CONTENT_CLASSNAME,
+ G_IRC_CONTENT_CONTRACTID, PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewPromptServiceFactory, kPromptServiceCID,
+ G_PROMPTSERVICE_CLASSNAME,
+ G_PROMPTSERVICE_CONTRACTID, PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ rv = RegisterFactory (NS_NewPrintingPromptServiceFactory,
+ kPrintingPromptServiceCID,
+ G_PRINTINGPROMPTSERVICE_CLASSNAME,
+ G_PRINTINGPROMPTSERVICE_CONTRACTID, PR_TRUE);
+ if (NS_FAILED(rv)) ret = FALSE;
+
+ return ret;
+}
+
+NS_METHOD RegisterFactory (nsresult (aFactoryFunc)(nsIFactory** aFactory),
+ const nsCID & aClass, const char *aClassName,
+ const char *aContractID, PRBool aReplace)
+{
+ nsresult rv = NS_OK;
+
+ nsCOMPtr<nsIFactory> factory;
+ rv = aFactoryFunc(getter_AddRefs(factory));
+ if (NS_FAILED(rv)) return rv;
+ rv = nsComponentManager::RegisterFactory(aClass, aClassName,
+ aContractID,
+ factory, aReplace);
+ return rv;
+}
+
+NS_METHOD RegisterComponent (const nsCID & aClass, const char *aClassName,
+ const char *aContractID, const char *aDLLPath,
+ PRBool aReplace)
+{
+ nsresult rv = NS_OK;
+
+ nsCOMPtr<nsILocalFile> dllFile;
+ rv = NS_NewLocalFile (NS_ConvertUTF8toUCS2(aDLLPath), PR_TRUE, getter_AddRefs (dllFile));
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ rv = nsComponentManager::RegisterComponentSpec (aClass,
+ aClassName,
+ aContractID,
+ dllFile,
+ aReplace,
+ PR_FALSE);
+ return rv;
+}
+
+/**
+ * mozilla_register_FtpProtocolHandler: Register Ftp Protocol Handler
+ */
+extern "C" gboolean
+mozilla_register_FtpProtocolHandler (void)
+{
+ if (ftpRegistered == PR_TRUE) return TRUE;
+
+ nsresult rv = NS_OK;
+
+ rv = nsComponentManager::FindFactory (knsFtpProtocolHandlerCID,
+ getter_AddRefs(nsFtpFactory));
+ if (NS_FAILED(rv)) return FALSE;
+
+ rv = RegisterFactory (NS_NewFtpHandlerFactory, kFtpHandlerCID,
+ G_FTP_PROTOCOL_CLASSNAME,
+ G_FTP_PROTOCOL_CONTRACTID, PR_TRUE);
+
+ if (NS_FAILED(rv)) return FALSE;
+
+ ftpRegistered = PR_TRUE;
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+}
+
+/**
+ * mozilla_unregister_FtpProtocolHandler: Unregister Ftp Protocol Handler
+ */
+extern "C" gboolean
+mozilla_unregister_FtpProtocolHandler (void)
+{
+ if (ftpRegistered == PR_FALSE) return FALSE;
+
+ nsresult rv = NS_OK;
+
+ rv = nsComponentManager::RegisterFactory(knsFtpProtocolHandlerCID,
+ NS_FTPPROTOCOLHANDLER_CLASSNAME,
+ G_FTP_PROTOCOL_CONTRACTID,
+ nsFtpFactory, PR_TRUE);
+
+ ftpRegistered = PR_FALSE;
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+}
+
+/**
+ * mozilla_register_MailtoProtocolHandler: Register Mailto Protocol Handler
+ */
+extern "C" gboolean
+mozilla_register_MailtoProtocolHandler (void)
+{
+ nsresult rv = NS_OK;
+
+ rv = RegisterFactory (NS_NewMailtoHandlerFactory, kMailtoHandlerCID,
+ G_MAILTO_PROTOCOL_CLASSNAME,
+ G_MAILTO_PROTOCOL_CONTRACTID, PR_TRUE);
+ if (NS_FAILED(rv)) return FALSE;
+
+ rv = RegisterFactory (NS_NewMailtoHandlerFactory, kMailtoHandlerCID,
+ G_MAILTO_CONTENT_CLASSNAME,
+ G_MAILTO_CONTENT_CONTRACTID, PR_TRUE);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+}
diff --git a/embed/mozilla/MozRegisterComponents.h b/embed/mozilla/MozRegisterComponents.h
new file mode 100644
index 000000000..a263d9b74
--- /dev/null
+++ b/embed/mozilla/MozRegisterComponents.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __MozRegisterComponents_h
+#define __MozRegisterComponents_h
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean mozilla_register_components (void);
+gboolean mozilla_register_FtpProtocolHandler (void);
+gboolean mozilla_unregister_FtpProtocolHandler (void);
+gboolean mozilla_register_MailtoProtocolHandler (void);
+
+G_END_DECLS
+
+#endif // __MozRegisterComponents_h
diff --git a/embed/mozilla/MozillaPrivate.cpp b/embed/mozilla/MozillaPrivate.cpp
new file mode 100644
index 000000000..a7bc50a6c
--- /dev/null
+++ b/embed/mozilla/MozillaPrivate.cpp
@@ -0,0 +1,105 @@
+#include "MozillaPrivate.h"
+
+#include <nsIServiceManagerUtils.h>
+#include <nsIWindowWatcher.h>
+#include <nsIEmbeddingSiteWindow.h>
+#include <nsIWebBrowserChrome.h>
+#include <gtkmozembed.h>
+
+GtkWidget *MozillaFindGtkParent (nsIDOMWindow *aDOMWindow)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIWindowWatcher> wwatch
+ (do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
+ if (!wwatch) return nsnull;
+
+ nsCOMPtr<nsIDOMWindow> domWindow(aDOMWindow);
+ if (!domWindow)
+ {
+ result = wwatch->GetActiveWindow(getter_AddRefs(domWindow));
+ if (NS_FAILED(result) || !domWindow) return nsnull;
+ }
+
+ nsCOMPtr<nsIWebBrowserChrome> windowChrome;
+ result = wwatch->GetChromeForWindow (domWindow,
+ getter_AddRefs(windowChrome));
+ if (NS_FAILED(result)) return nsnull;
+
+ nsCOMPtr<nsIEmbeddingSiteWindow> window
+ (do_QueryInterface(windowChrome, &result));
+ if (NS_FAILED(result)) return nsnull;
+
+ GtkWidget *mozembed;
+ result = window->GetSiteWindow ((void **)&mozembed);
+ if (NS_FAILED(result)) return nsnull;
+
+ return gtk_widget_get_toplevel (GTK_WIDGET(mozembed));
+}
+
+
+NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
+ nsIPrintSettings *options)
+{
+ const static int frame_types[] = {
+ nsIPrintSettings::kFramesAsIs,
+ nsIPrintSettings::kSelectedFrame,
+ nsIPrintSettings::kEachFrameSep
+ };
+ /* these should match the order of the radiobuttons in the dialog
+ * and the paper names in the default print provider PS*/
+ const static char *PaperSizeNames[] = {
+ "Letter","Legal","Executive","A4"
+ };
+
+
+ switch (info->pages)
+ {
+ case 0:
+ break;
+ case 1:
+ options->SetPrintRange (nsIPrintSettings::kRangeSpecifiedPageRange);
+ options->SetStartPageRange (info->from_page);
+ options->SetEndPageRange (info->to_page);
+ break;
+ case 2:
+ options->SetPrintRange (nsIPrintSettings::kRangeSelection);
+ break;
+ }
+
+ options->SetMarginTop (info->top_margin);
+ options->SetMarginBottom (info->bottom_margin);
+ options->SetMarginLeft (info->left_margin);
+ options->SetMarginRight (info->right_margin);
+
+ options->SetPrinterName(NS_LITERAL_STRING("PostScript/default").get());
+
+ options->SetHeaderStrLeft(NS_ConvertUTF8toUCS2(info->header_left_string).get());
+
+ options->SetHeaderStrCenter(NS_ConvertUTF8toUCS2(info->header_center_string).get());
+
+ options->SetHeaderStrRight(NS_ConvertUTF8toUCS2(info->header_right_string).get());
+
+ options->SetFooterStrLeft(NS_ConvertUTF8toUCS2(info->footer_left_string).get());
+
+ options->SetFooterStrCenter(NS_ConvertUTF8toUCS2(info->footer_center_string).get());
+
+ options->SetFooterStrRight(NS_ConvertUTF8toUCS2(info->footer_right_string).get());
+
+ options->SetToFileName (NS_ConvertUTF8toUCS2(info->file).get());
+
+ options->SetPrintCommand (NS_ConvertUTF8toUCS2(info->printer).get());
+
+ options->SetPrintToFile (info->print_to_file);
+
+ /* native paper size formats. Our dialog does not support custom yet */
+ options->SetPaperSize (nsIPrintSettings::kPaperSizeNativeData);
+ int tps = (info->paper >= 0 || info->paper < 4) ? info->paper : 0;
+ options->SetPaperName (NS_ConvertUTF8toUCS2(PaperSizeNames[tps]).get());
+
+ options->SetPrintInColor (info->print_color);
+ options->SetOrientation (info->orientation);
+ options->SetPrintFrameType (frame_types[info->frame_type]);
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/MozillaPrivate.h b/embed/mozilla/MozillaPrivate.h
new file mode 100644
index 000000000..be9ab4905
--- /dev/null
+++ b/embed/mozilla/MozillaPrivate.h
@@ -0,0 +1,9 @@
+#include <nsIPrintSettings.h>
+#include <nsIDOMWindow.h>
+
+#include "ephy-embed.h"
+
+GtkWidget *MozillaFindGtkParent (nsIDOMWindow *aDOMWindow);
+
+NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
+ nsIPrintSettings *settings);
diff --git a/embed/mozilla/PrintProgressListener.cpp b/embed/mozilla/PrintProgressListener.cpp
new file mode 100644
index 000000000..b4cf7b701
--- /dev/null
+++ b/embed/mozilla/PrintProgressListener.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2002 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "libgnomevfs/gnome-vfs-mime-handlers.h"
+
+/* see the FIXME below */
+#include <locale.h>
+
+#include <libgnome/gnome-exec.h>
+
+#include "PrintProgressListener.h"
+
+
+NS_IMPL_ISUPPORTS1(GPrintListener, nsIWebProgressListener)
+
+GPrintListener::GPrintListener()
+{
+ NS_INIT_ISUPPORTS();
+ mFilename = NULL;
+}
+
+GPrintListener::GPrintListener(char *filename)
+{
+ GPrintListener ();
+ mFilename = filename ? g_strdup (filename) : NULL;
+}
+
+GPrintListener::~GPrintListener()
+{
+ g_free (mFilename);
+}
+
+/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */
+NS_IMETHODIMP GPrintListener::OnStateChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ PRUint32 aStateFlags,
+ PRUint32 aStatus)
+{
+ if (aStateFlags & nsIWebProgressListener::STATE_STOP)
+ {
+ GnomeVFSMimeApplication *app;
+ gchar *command;
+
+ /* FIXME(MOZILLA) ugly workaround for a mozilla problem with
+ * reseting the LC_* environment when printing */
+ setlocale(LC_ALL,"");
+ if (!mFilename) return NS_OK;
+
+ /* get the postscript handler */
+ app = gnome_vfs_mime_get_default_application
+ ("application/postscript");
+ if (app)
+ {
+ command = g_strconcat (app->command, " ",
+ mFilename, NULL);
+ gnome_execute_shell (g_get_home_dir(), command);
+ gnome_vfs_mime_application_free (app);
+ g_free (command);
+ }
+ else return NS_ERROR_FAILURE;
+ }
+ return NS_OK;
+}
+
+/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
+NS_IMETHODIMP GPrintListener::OnProgressChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ PRInt32 aCurSelfProgress,
+ PRInt32 aMaxSelfProgress,
+ PRInt32 aCurTotalProgress,
+ PRInt32 aMaxTotalProgress)
+{
+ return NS_OK;
+}
+
+/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
+NS_IMETHODIMP GPrintListener::OnLocationChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ nsIURI *location)
+{
+ return NS_OK;
+}
+
+/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
+NS_IMETHODIMP GPrintListener::OnStatusChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ nsresult aStatus,
+ const PRUnichar *aMessage)
+{
+ return NS_OK;
+}
+
+/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */
+NS_IMETHODIMP GPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ PRUint32 state)
+{
+ return NS_OK;
+}
+
+
diff --git a/embed/mozilla/PrintProgressListener.h b/embed/mozilla/PrintProgressListener.h
new file mode 100644
index 000000000..82577d8ea
--- /dev/null
+++ b/embed/mozilla/PrintProgressListener.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2002 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PrintProgressListener_h_
+#define __PrintProgressListener_h_
+
+#include "nsIWebProgressListener.h"
+
+class GPrintListener : public nsIWebProgressListener
+{
+public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIWEBPROGRESSLISTENER
+
+ GPrintListener();
+ GPrintListener(char *filename);
+ virtual ~GPrintListener();
+
+private:
+ char *mFilename;
+};
+
+#endif //__PrintProgressListener_h_
diff --git a/embed/mozilla/PrintingPromptService.cpp b/embed/mozilla/PrintingPromptService.cpp
new file mode 100644
index 000000000..6d1430ddc
--- /dev/null
+++ b/embed/mozilla/PrintingPromptService.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2002 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtkdialog.h>
+
+#include "print-dialog.h"
+#include "ephy-embed.h"
+#include "MozillaPrivate.h"
+
+#include <nsIPrintSettings.h>
+#include <nsCOMPtr.h>
+#include <nsIFactory.h>
+#include <nsString.h>
+#include <nsIServiceManager.h>
+#include <nsXPComFactory.h>
+
+#include <nsIPrintingPromptService.h>
+
+/* Header file */
+class GPrintingPromptService : public nsIPrintingPromptService
+{
+public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIPRINTINGPROMPTSERVICE
+
+ GPrintingPromptService();
+ virtual ~GPrintingPromptService();
+ /* additional members */
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1(GPrintingPromptService, nsIPrintingPromptService)
+
+GPrintingPromptService::GPrintingPromptService()
+{
+ NS_INIT_ISUPPORTS();
+ /* member initializers and constructor code */
+}
+
+GPrintingPromptService::~GPrintingPromptService()
+{
+ /* destructor code */
+}
+
+/* void showPrintDialog (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */
+NS_IMETHODIMP GPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
+{
+ EphyDialog *dialog;
+ EmbedPrintInfo *info;
+
+ GtkWidget *gtkParent = MozillaFindGtkParent(parent);
+
+ dialog = print_dialog_new_with_parent (gtkParent, NULL, &info);
+ ephy_dialog_set_modal (dialog, TRUE);
+
+ gint ret = ephy_dialog_run (dialog);
+ if(ret == GTK_RESPONSE_OK)
+ {
+ MozillaCollatePrintSettings(info, printSettings);
+ print_free_info(info);
+
+ return NS_OK;
+ }
+ else
+ return NS_ERROR_FAILURE;
+}
+
+/* void showProgress (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, in nsIObserver openDialogObserver, in boolean isForPrinting, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams, out boolean notifyOnOpen); */
+NS_IMETHODIMP GPrintingPromptService::ShowProgress(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings, nsIObserver *openDialogObserver, PRBool isForPrinting, nsIWebProgressListener **webProgressListener, nsIPrintProgressParams **printProgressParams, PRBool *notifyOnOpen)
+{
+ printf("GPrintingPromptService::ShowProgress called\n");
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings, in nsIObserver printObserver); */
+NS_IMETHODIMP GPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings,
+ nsIObserver *printObserver)
+{
+ printf("GPrintingPromptService::ShowPageSetup called\n");
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */
+NS_IMETHODIMP GPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings)
+{
+ printf("GPrintingPromptService::ShowPrinterProperties called\n");
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_DEF_FACTORY (GPrintingPromptService, GPrintingPromptService);
+
+/**
+ * NS_NewPromptServiceFactory:
+ */
+nsresult NS_NewPrintingPromptServiceFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGPrintingPromptServiceFactory *result = new nsGPrintingPromptServiceFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/PrintingPromptService.h b/embed/mozilla/PrintingPromptService.h
new file mode 100644
index 000000000..08024c632
--- /dev/null
+++ b/embed/mozilla/PrintingPromptService.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PrintingPromptService_h
+#define __PrintingPromptService_h
+
+#include "nsError.h"
+
+#define G_PRINTINGPROMPTSERVICE_CID \
+{ /* 5998a2d3-88ea-4c52-b4bb-4e7abd0d35e0 */ \
+ 0x5998a2d3, \
+ 0x88ea, \
+ 0x4c52, \
+ {0xb4, 0xbb, 0x4e, 0x7a, 0xbd, 0x0d, 0x35, 0xe0} \
+}
+
+#define G_PRINTINGPROMPTSERVICE_CLASSNAME "Galeon's Printing Prompt Service"
+#define G_PRINTINGPROMPTSERVICE_CONTRACTID "@mozilla.org/embedcomp/printingprompt-service;1"
+class nsIFactory;
+
+extern nsresult NS_NewPrintingPromptServiceFactory(nsIFactory** aFactory);
+
+#endif
diff --git a/embed/mozilla/ProgressListener.cpp b/embed/mozilla/ProgressListener.cpp
new file mode 100644
index 000000000..aed42d97a
--- /dev/null
+++ b/embed/mozilla/ProgressListener.cpp
@@ -0,0 +1,718 @@
+/*
+ * Copyright (C) 2001 Philip Langdale, Matthew Aubury
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ProgressListener.h"
+
+#include "eel-gconf-extensions.h"
+#include "ephy-file-helpers.h"
+
+#include <unistd.h>
+#include <libgnome/gnome-exec.h>
+#include <libgnome/gnome-i18n.h>
+
+#include "nsXPIDLString.h"
+#include "nsIChannel.h"
+#include "nsIFTPChannel.h"
+#include "nsIFactory.h"
+#include "nsXPComFactory.h"
+#include "nsIMIMEInfo.h"
+#include "nsCOMPtr.h"
+
+static void
+download_remove_cb (DownloaderView *dv, GProgressListener *Progress);
+static void
+download_resume_cb (DownloaderView *dv, GProgressListener *Progress);
+static void
+download_pause_cb (DownloaderView *dv, GProgressListener *Progress);
+
+NS_IMPL_ISUPPORTS4 (GProgressListener, nsIDownload, nsIWebProgressListener,
+ nsIProgressDialog, nsISupportsWeakReference)
+
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+
+GProgressListener::GProgressListener () : mLauncher(nsnull),
+ mPersist(nsnull),
+ mHandler(nsnull),
+ mObserver(nsnull),
+ mMIMEInfo(nsnull),
+ mPercentComplete(0)
+{
+ NS_INIT_ISUPPORTS ();
+}
+
+GProgressListener::~GProgressListener ()
+{
+ /* destructor code */
+}
+
+NS_METHOD GProgressListener::InitForPersist (nsIWebBrowserPersist *aPersist,
+ nsIDOMWindow *aParent,
+ nsIURI *aURI,
+ nsIFile *aFile,
+ DownloadAction aAction,
+ EphyEmbedPersist *ephyPersist,
+ PRBool noDialog,
+ PRInt64 aTimeDownloadStarted)
+{
+ nsresult rv;
+
+ /* fill in download details */
+ mAction = aAction;
+ mParent = aParent;
+ mNoDialog = noDialog;
+ mUri = aURI;
+ mFile = aFile;
+ mPersist = aPersist;
+ mTimeDownloadStarted = aTimeDownloadStarted;
+ mEphyPersist = ephyPersist;
+
+ /* do remaining init */
+ rv = PrivateInit ();
+
+ /* pick up progress messages */
+ mPersist->SetProgressListener (this);
+
+ /* done */
+ return rv;
+}
+
+NS_METHOD GProgressListener::InitForDownload (nsIHelperAppLauncher *aLauncher,
+ nsISupports *aContext,
+ GContentHandler *aHandler,
+ DownloadAction aAction)
+{
+ nsresult rv;
+
+ mNoDialog = 0;
+
+ /* fill in download details */
+ mAction = aAction;
+ mParent = do_QueryInterface (aContext);
+ mNoDialog = PR_TRUE;
+ mHandler = aHandler;
+ mLauncher = aLauncher;
+ rv = mLauncher->GetDownloadInfo (getter_AddRefs (mUri),
+ &mTimeDownloadStarted,
+ getter_AddRefs (mFile));
+
+ /* do remaining init */
+ rv = PrivateInit ();
+
+ /* pick up progress messages */
+ mLauncher->SetWebProgressListener (this);
+
+ /* done */
+ return rv;
+}
+
+NS_METHOD GProgressListener::PrivateInit (void)
+{
+ nsresult rv;
+
+ /* setup this download */
+ mInterval = 500000; /* in microsecs == 500ms == 0.5s */
+ mPriorKRate = 0;
+ mRateChanges = 0;
+ mRateChangeLimit = 2; /* only update rate every second */
+ mCheckedCanPause = PR_FALSE;
+ mCanPause = PR_FALSE;
+ mIsPaused = PR_FALSE;
+ mAbort = PR_FALSE;
+ PRInt64 now = PR_Now ();
+ mLastUpdate = now;
+
+// mStartTime = (mTimeDownloadStarted != 0 ?
+// mTimeDownloadStarted : now);
+ mStartTime = now; //Stupid mozilla race condition
+
+ mElapsed = now - mStartTime;
+
+ if (!mNoDialog)
+ {
+ gchar *filename, *source, *dest;
+ nsAutoString uTmp;
+ nsCAutoString cTmp;
+
+ rv = mFile->GetLeafName (uTmp);
+ filename = g_strdup (NS_ConvertUCS2toUTF8(uTmp).get());
+
+ rv = mFile->GetPath (uTmp);
+ dest = g_strdup (NS_ConvertUCS2toUTF8(uTmp).get());
+
+ rv = mUri->GetSpec (cTmp);
+ source = g_strdup (cTmp.get());
+ DownloaderView *dv;
+ dv = ephy_embed_shell_get_downloader_view (embed_shell);
+ downloader_view_add_download (dv, filename, source, dest, (gpointer)this);
+ g_signal_connect (G_OBJECT (dv),
+ "download_remove",
+ G_CALLBACK (download_remove_cb),
+ this);
+ g_signal_connect (G_OBJECT (dv),
+ "download_pause",
+ G_CALLBACK (download_pause_cb),
+ this);
+ g_signal_connect (G_OBJECT (dv),
+ "download_resume",
+ G_CALLBACK (download_resume_cb),
+ this);
+ mDownloaderView = dv;
+ }
+
+ /* done */
+ return NS_OK;
+}
+
+NS_IMETHODIMP GProgressListener::Init(nsIURI *aSource,
+ nsILocalFile *aTarget,
+ const PRUnichar *aDisplayName,
+ nsIMIMEInfo *aMIMEInfo,
+ PRInt64 aStartTime,
+ nsIWebBrowserPersist *aPersist)
+{
+ mUri = aSource;
+ mFile = aTarget;
+ mTimeDownloadStarted = aStartTime;
+ mStartTime = aStartTime;
+ mPersist = aPersist;
+ mMIMEInfo = aMIMEInfo;
+ mAction = ACTION_NONE;
+ if(mMIMEInfo)
+ {
+ nsMIMEInfoHandleAction mimeAction;
+ if(NS_SUCCEEDED(mMIMEInfo->GetPreferredAction(&mimeAction)))
+ {
+ mAction = (mimeAction == nsIMIMEInfo::useHelperApp) ?
+ ACTION_SAVEFORHELPER : ACTION_NONE;
+ }
+ }
+ mNoDialog = 0;
+
+ return PrivateInit();
+}
+
+NS_IMETHODIMP GProgressListener::Open(nsIDOMWindow *aParent)
+{
+ mParent = aParent;
+ mNoDialog = 0;
+
+ return NS_OK;
+}
+
+/* attribute long long startTime; */
+NS_IMETHODIMP GProgressListener::GetStartTime(PRInt64 *aStartTime)
+{
+ *aStartTime = mStartTime;
+ return NS_OK;
+}
+
+/* attribute nsIURI source; */
+NS_IMETHODIMP GProgressListener::GetSource(nsIURI * *aSource)
+{
+ NS_IF_ADDREF(*aSource = mUri);
+ return NS_OK;
+}
+
+/* attribute nsILocalFile target; */
+NS_IMETHODIMP GProgressListener::GetTarget(nsILocalFile * *aTarget)
+{
+ nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(mFile);
+ NS_IF_ADDREF(*aTarget = localFile);
+ return NS_OK;
+}
+
+NS_IMETHODIMP GProgressListener::GetMIMEInfo(nsIMIMEInfo * *aMIMEInfo)
+{
+ NS_IF_ADDREF(*aMIMEInfo = mMIMEInfo);
+ return NS_OK;
+}
+
+/* attribute nsIObserver observer; */
+NS_IMETHODIMP GProgressListener::GetObserver(nsIObserver * *aObserver)
+{
+ NS_IF_ADDREF(*aObserver = mObserver);
+ return NS_OK;
+}
+NS_IMETHODIMP GProgressListener::SetObserver(nsIObserver * aObserver)
+{
+ mObserver = aObserver;
+ return NS_OK;
+}
+
+/* attribute nsIWebProgressListener listener; */
+NS_IMETHODIMP GProgressListener::GetListener(nsIWebProgressListener * *aListener)
+{
+ *aListener = nsnull;
+ return NS_OK;
+}
+NS_IMETHODIMP GProgressListener::SetListener(nsIWebProgressListener * aListener)
+{
+ return NS_OK;
+}
+
+/* readonly attribute PRInt32 percentComplete; */
+NS_IMETHODIMP GProgressListener::GetPercentComplete(PRInt32 *aPercentComplete)
+{
+ return *aPercentComplete = mPercentComplete;
+}
+
+/* attribute wstring displayName; */
+NS_IMETHODIMP GProgressListener::GetDisplayName(PRUnichar * *aDisplayName)
+{
+ *aDisplayName = nsnull;
+ return NS_OK;
+}
+NS_IMETHODIMP GProgressListener::SetDisplayName(const PRUnichar * aDisplayName)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP GProgressListener::GetPersist(nsIWebBrowserPersist * *aPersist)
+{
+ NS_IF_ADDREF(*aPersist = mPersist);
+ return NS_OK;
+}
+
+NS_IMETHODIMP GProgressListener::SetDialog(nsIDOMWindow *aDialog)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP GProgressListener::GetDialog(nsIDOMWindow * *aDialog)
+{
+ *aDialog = nsnull;
+ return NS_OK;
+}
+
+/* attribute PRBool cancelDownloadOnClose; */
+NS_IMETHODIMP GProgressListener::GetCancelDownloadOnClose(PRBool *aCancelDownloadOnClose)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP GProgressListener::SetCancelDownloadOnClose(PRBool aCancelDownloadOnClose)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP GProgressListener::LaunchHandler (PersistHandlerInfo *handler)
+{
+ nsresult rv;
+ nsCOMPtr<nsIExternalHelperAppService> helperService =
+ do_GetService (NS_EXTERNALHELPERAPPSERVICE_CONTRACTID);
+
+ nsCOMPtr<nsPIExternalAppLauncher> appLauncher =
+ do_QueryInterface (helperService, &rv);
+ if (NS_SUCCEEDED(rv))
+ {
+ appLauncher->DeleteTemporaryFileOnExit(mFile);
+ }
+
+ nsAutoString uFileName;
+
+ mFile->GetPath(uFileName);
+ const nsACString &cFileName = NS_ConvertUCS2toUTF8(uFileName);
+
+ char *fname = g_strdup(PromiseFlatCString(cFileName).get());
+ ephy_file_launch_application (handler->command,
+ fname,
+ handler->need_terminal);
+ g_free (fname);
+
+ return NS_OK;
+}
+
+/*
+ * void onStateChange (in nsIWebProgress aWebProgress,
+ * in nsIRequest aRequest,
+ * in long aStateFlags,
+ * in unsigned long aStatus);
+ */
+NS_IMETHODIMP GProgressListener::OnStateChange (nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ PRUint32 aStateFlags,
+ PRUint32 aStatus)
+{
+ if (mAbort) return NS_ERROR_FAILURE;
+
+ if (aStateFlags & nsIWebProgressListener::STATE_STOP)
+ {
+ switch (mAction)
+ {
+ case ACTION_SAVEFORHELPER:
+ LaunchHelperApp();
+ break;
+
+ case ACTION_NONE:
+ if (mLauncher)
+ {
+ mLauncher->CloseProgressWindow ();
+ }
+ break;
+ case ACTION_OBJECT_NOTIFY:
+
+ g_return_val_if_fail (IS_EPHY_EMBED_PERSIST (mEphyPersist),
+ NS_ERROR_FAILURE);
+
+ PersistHandlerInfo *handler;
+
+ g_object_get (mEphyPersist,
+ "handler", &handler,
+ NULL);
+
+ if (handler)
+ {
+ LaunchHandler (handler);
+ }
+
+ g_signal_emit_by_name (mEphyPersist, "completed");
+ }
+
+ if (!mNoDialog)
+ {
+ downloader_view_set_download_status (mDownloaderView,
+ DOWNLOAD_STATUS_COMPLETED,
+ (gpointer)this);
+ }
+ }
+
+ /* done */
+ return NS_OK;
+}
+
+/*
+ * void onProgressChange (in nsIWebProgress aWebProgress,
+ * in nsIRequest aRequest,
+ * in long aCurSelfProgress,
+ * in long aMaxSelfProgress,
+ * in long aCurTotalProgress,
+ * in long aMaxTotalProgress);
+ */
+NS_IMETHODIMP GProgressListener::
+ OnProgressChange (nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ PRInt32 aCurSelfProgress,
+ PRInt32 aMaxSelfProgress,
+ PRInt32 aCurTotalProgress,
+ PRInt32 aMaxTotalProgress)
+{
+ if (mAbort) return NS_ERROR_FAILURE;
+
+ /* FIXME maxsize check here */
+
+ if (mNoDialog) return NS_OK;
+
+ if (!mCheckedCanPause)
+ {
+ mCheckedCanPause = PR_TRUE;
+
+ nsresult rv;
+ nsCOMPtr<nsIFTPChannel> channel =
+ do_QueryInterface (aRequest, &rv);
+
+ mCanPause = (NS_SUCCEEDED (rv) ? PR_TRUE : PR_FALSE);
+ }
+ mRequest = aRequest;
+
+ PRInt64 now = PR_Now ();
+
+ /* get out if we're updating too quickly */
+ if ((now - mLastUpdate < mInterval) &&
+ (aMaxTotalProgress != -1) &&
+ (aCurTotalProgress < aMaxTotalProgress))
+ {
+ return NS_OK;
+ }
+
+ /* compute elapsed time */
+ mLastUpdate = now;
+ mElapsed = now - mStartTime;
+
+ /* compute size done */
+ PRInt32 currentKBytes = (PRInt32)(aCurTotalProgress / 1024.0 + 0.5);
+
+ /* compute total size */
+ PRInt32 totalKBytes = (PRInt32)(aMaxTotalProgress / 1024.0 + 0.5);
+
+ /* compute progress value */
+ gfloat progress = -1;
+ if (aMaxTotalProgress > 0)
+ {
+ progress = (gfloat)aCurTotalProgress /
+ (gfloat)aMaxTotalProgress;
+ }
+
+ /* compute download rate */
+ gfloat speed = -1;
+ PRInt64 currentRate;
+ if (mElapsed)
+ {
+ currentRate = ((PRInt64)(aCurTotalProgress)) * 1000000 /
+ mElapsed;
+ }
+ else
+ {
+ currentRate = 0;
+ }
+
+ if (!mIsPaused)
+ {
+ if (currentRate)
+ {
+ PRFloat64 currentKRate = ((PRFloat64)currentRate)/1024;
+ if (currentKRate != mPriorKRate)
+ {
+ if (mRateChanges++ == mRateChangeLimit)
+ {
+ mPriorKRate = currentKRate;
+ mRateChanges = 0;
+ }
+ else
+ {
+ currentKRate = mPriorKRate;
+ }
+ }
+ else
+ {
+ mRateChanges = 0;
+ }
+
+ speed = currentKRate;
+ }
+ }
+
+ /* compute time remaining */
+ gint remaining = -1;
+ if (currentRate && (aMaxTotalProgress > 0))
+ {
+ remaining =
+ (gint)((aMaxTotalProgress - aCurTotalProgress)
+ /currentRate +.5);
+ }
+
+ downloader_view_set_download_progress (mDownloaderView,
+ mElapsed,
+ remaining,
+ speed,
+ totalKBytes,
+ currentKBytes,
+ progress,
+ mCanPause,
+ (gpointer)this);
+
+ /* done */
+ return NS_OK;
+}
+
+/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
+NS_IMETHODIMP GProgressListener::
+ OnLocationChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest, nsIURI *location)
+{
+ return NS_OK;
+}
+
+/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
+NS_IMETHODIMP GProgressListener::
+ OnStatusChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest, nsresult aStatus,
+ const PRUnichar *aMessage)
+{
+ return NS_OK;
+}
+
+/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */
+NS_IMETHODIMP GProgressListener::
+ OnSecurityChange(nsIWebProgress *aWebProgress,
+ nsIRequest *aRequest,
+ PRUint32 state)
+{
+ return NS_OK;
+}
+
+//---------------------------------------------------------------------------
+
+NS_METHOD GProgressListener::LaunchHelperApp (void)
+{
+ if (!mMIMEInfo)
+ return NS_ERROR_FAILURE;
+
+ nsresult rv;
+
+ nsCOMPtr<nsIFile> helperFile;
+ rv = mMIMEInfo->GetPreferredApplicationHandler(getter_AddRefs(helperFile));
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsCAutoString helperFileName;
+ rv = helperFile->GetNativePath(helperFileName);
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsMIMEInfoHandleAction mimeAction;
+ rv = mMIMEInfo->GetPreferredAction(&mimeAction);
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIExternalHelperAppService> helperService =
+ do_GetService (NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, &rv);
+ if (NS_SUCCEEDED(rv))
+ {
+ nsCOMPtr<nsPIExternalAppLauncher> appLauncher =
+ do_QueryInterface (helperService, &rv);
+ if (NS_SUCCEEDED(rv))
+ {
+ appLauncher->DeleteTemporaryFileOnExit(mFile);
+ }
+ }
+
+ nsCAutoString cFileName;
+ mFile->GetNativePath(cFileName);
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsXPIDLString helperDesc;
+ rv = mMIMEInfo->GetApplicationDescription(getter_Copies(helperDesc));
+ if(NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ gboolean terminalHelper =
+ helperDesc.Equals(NS_LITERAL_STRING("runInTerminal")) ?
+ TRUE : FALSE;
+
+ ephy_file_launch_application (helperFileName.get(),
+ cFileName.get(),
+ terminalHelper);
+
+ return NS_OK;
+}
+
+nsresult GProgressListener::Pause (void)
+{
+ nsresult rv;
+
+ if (mCanPause && !mIsPaused)
+ {
+ rv = mRequest->Suspend ();
+ if (NS_SUCCEEDED (rv))
+ {
+ mIsPaused = PR_TRUE;
+ }
+ }
+ else
+ {
+ rv = NS_ERROR_FAILURE;
+ }
+
+ return rv;
+}
+
+nsresult GProgressListener::Resume (void)
+{
+ nsresult rv;
+
+ if (mCanPause && mIsPaused)
+ {
+ rv = mRequest->Resume ();
+ if (NS_SUCCEEDED (rv))
+ {
+ mIsPaused = PR_FALSE;
+ }
+ }
+ else
+ {
+ rv = NS_ERROR_FAILURE;
+ }
+
+ return rv;
+}
+
+nsresult GProgressListener::Abort (void)
+{
+ mAction = ACTION_NONE;
+
+ if (mIsPaused)
+ {
+ Resume ();
+ }
+
+ mAbort = PR_TRUE;
+
+ if (mObserver)
+ {
+ mObserver->Observe(NS_ISUPPORTS_CAST(nsIProgressDialog*, this),
+ "oncancel", nsnull);
+ OnStateChange(nsnull, nsnull,
+ nsIWebProgressListener::STATE_STOP, 0);
+ }
+
+ if (mPersist)
+ {
+ return mPersist->CancelSave ();
+ }
+
+ if (mLauncher)
+ {
+ return mLauncher->Cancel ();
+ }
+ else
+ {
+ return NS_ERROR_FAILURE;
+ }
+}
+
+NS_DEF_FACTORY (GProgressListener, GProgressListener);
+
+/**
+ * NS_NewProgressListenerFactory:
+ */
+nsresult NS_NewProgressListenerFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGProgressListenerFactory *result = new nsGProgressListenerFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
+
+static void
+download_remove_cb (DownloaderView *dv, GProgressListener *Progress)
+{
+ Progress->Abort();
+}
+
+static void
+download_resume_cb (DownloaderView *dv, GProgressListener *Progress)
+{
+ Progress->Resume();
+}
+
+static void
+download_pause_cb (DownloaderView *dv, GProgressListener *Progress)
+{
+ Progress->Pause();
+}
diff --git a/embed/mozilla/ProgressListener.h b/embed/mozilla/ProgressListener.h
new file mode 100644
index 000000000..459643194
--- /dev/null
+++ b/embed/mozilla/ProgressListener.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2001 Philip Langdale, Matthew Aubury
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PROGRESSLISTENER2_H__
+#define PROGRESSLISTENER2_H__
+
+#include "downloader-view.h"
+#include "ephy-embed-persist.h"
+#include "ephy-embed-shell.h"
+
+#include <gtk/gtkwidget.h>
+#include "nsIWebProgressListener.h"
+#include "nsIHelperAppLauncherDialog.h"
+#include "nsIExternalHelperAppService.h"
+#include "nsCExternalHandlerService.h"
+#include "nsIWebBrowserPersist.h"
+#include "nsCOMPtr.h"
+#include "nsWeakReference.h"
+#include "nsIURI.h"
+#include "nsILocalFile.h"
+#include "nsIDOMWindow.h"
+#include "nsIRequest.h"
+#include "nsIMIMEInfo.h"
+#include "nsIDownload.h"
+#include "nsIObserver.h"
+#include "nsIProgressDialog.h"
+
+#include "ContentHandler.h"
+
+#define G_PROGRESSDIALOG_CID \
+{ /* d2a2f743-f126-4f1f-1234-d4e50490f112 */ \
+ 0xd2a2f743, \
+ 0xf126, \
+ 0x4f1f, \
+ {0x12, 0x34, 0xd4, 0xe5, 0x04, 0x90, 0xf1, 0x12} \
+}
+
+#define G_PROGRESSDIALOG_CLASSNAME "Ephy's Download Progress Dialog"
+#define G_PROGRESSDIALOG_CONTRACTID "@mozilla.org/progressdialog;1"
+
+class GProgressListener : public nsIProgressDialog,
+ public nsIWebProgressListener,
+ public nsSupportsWeakReference
+{
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIWEBPROGRESSLISTENER
+ NS_DECL_NSIPROGRESSDIALOG
+ NS_DECL_NSIDOWNLOAD
+
+ GProgressListener ();
+ virtual ~GProgressListener ();
+
+ NS_METHOD InitForPersist (nsIWebBrowserPersist *aPersist,
+ nsIDOMWindow *aParent, nsIURI *aURI,
+ nsIFile *aFile,
+ DownloadAction aAction,
+ EphyEmbedPersist *ephyPersist,
+ PRBool noDialog,
+ PRInt64 aTimeDownloadStarted = 0);
+ NS_METHOD InitForDownload (nsIHelperAppLauncher *aLauncher,
+ nsISupports *aContext,
+ GContentHandler *aHandler,
+ DownloadAction aDownload);
+
+ nsresult Pause (void);
+ nsresult Resume (void);
+ nsresult Abort (void);
+
+ GTimer *mTimer;
+
+ private:
+ NS_METHOD PrivateInit (void);
+ NS_METHOD LaunchHelperApp (void);
+
+ NS_METHOD LaunchHandler (PersistHandlerInfo *handler);
+
+ nsCOMPtr<nsIHelperAppLauncher> mLauncher;
+ nsCOMPtr<nsIWebBrowserPersist> mPersist;
+ nsCOMPtr<GContentHandler> mHandler;
+ nsCOMPtr<nsIDOMWindow> mParent;
+ nsCOMPtr<nsIRequest> mRequest;
+
+ EphyEmbedPersist *mEphyPersist;
+
+ nsCOMPtr<nsIURI> mUri;
+ PRInt64 mTimeDownloadStarted;
+ nsCOMPtr<nsIFile> mFile;
+
+ PRInt64 mStartTime;
+ PRInt64 mElapsed;
+
+ PRInt64 mLastUpdate;
+ PRInt32 mInterval;
+
+ PRFloat64 mPriorKRate;
+ PRInt32 mRateChanges;
+ PRInt32 mRateChangeLimit;
+
+ PRBool mCheckedCanPause;
+ PRBool mCanPause;
+ PRBool mIsPaused;
+ gboolean mNoDialog;
+ PRBool mAbort;
+
+ DownloadAction mAction;
+
+ DownloaderView *mDownloaderView;
+
+ EphyEmbedShell *ephy_shell;
+
+ guint mTimeoutFunc;
+
+ nsCOMPtr<nsIObserver> mObserver;
+
+ nsCOMPtr<nsIMIMEInfo> mMIMEInfo;
+
+ PRInt32 mPercentComplete;
+};
+
+extern nsresult NS_NewProgressListenerFactory(nsIFactory** aFactory);
+
+#endif // PROGRESSLISTENER2_H__
+
diff --git a/embed/mozilla/PromptService.cpp b/embed/mozilla/PromptService.cpp
new file mode 100644
index 000000000..c9244dd32
--- /dev/null
+++ b/embed/mozilla/PromptService.cpp
@@ -0,0 +1,769 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-glade.h"
+#include "PromptService.h"
+
+#include "nsCOMPtr.h"
+#include "nsIFactory.h"
+#include "nsString.h"
+#include "nsReadableUtils.h"
+#include "nsIServiceManager.h"
+#include "nsXPComFactory.h"
+#include "MozillaPrivate.h"
+
+#include "nsIPromptService.h"
+#include "nsIUnicodeEncoder.h"
+
+#include <gtk/gtkentry.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtklist.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-triggers.h>
+
+/* local function prototypes */
+static void set_title (GtkWidget *dialog, const PRUnichar *title);
+static void set_label_text (GtkWidget *label, const PRUnichar *text);
+static void set_check_button_text (GtkWidget *check_button,
+ const PRUnichar *text);
+static void set_check_button (GtkWidget *button, PRBool *value);
+static void set_check_button_size_to_label (GtkWidget *check_button,
+ GtkWidget *label);
+static void set_editable (GtkWidget *entry, PRUnichar **text);
+static void get_check_button (GtkWidget *button, PRBool *value);
+static void get_editable (GtkWidget *editable, PRUnichar **text);
+
+/**
+ * class CPromptService: an GNOME implementation of prompt dialogs for
+ * Mozilla
+ */
+class CPromptService: public nsIPromptService
+{
+ public:
+ CPromptService();
+ virtual ~CPromptService();
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIPROMPTSERVICE
+ private:
+ nsresult AddButton (GtkWidget *dialog,
+ char type,
+ const PRUnichar *title,
+ int id);
+};
+
+NS_IMPL_ISUPPORTS1 (CPromptService, nsIPromptService)
+
+/**
+ * CPromptService::CPromptService: constructor
+ */
+CPromptService::CPromptService ()
+{
+ NS_INIT_ISUPPORTS();
+}
+
+/**
+ * CPromptService::~CPromptService: destructor
+ */
+CPromptService::~CPromptService ()
+{
+}
+
+/**
+ * CPromptService::Alert: show an alert box
+ */
+NS_IMETHODIMP CPromptService::Alert (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text)
+{
+ GtkWidget *dialog;
+ GtkWidget *gparent;
+
+ gparent = MozillaFindGtkParent (parent);
+ const nsACString &msg = NS_ConvertUCS2toUTF8 (text);
+ dialog = gtk_message_dialog_new (GTK_WINDOW(gparent),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "%s",
+ PromiseFlatCString(msg).get ());
+ set_title (dialog, dialogTitle);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ return NS_OK;
+}
+
+/**
+ * CPromptService::AlertCheck: show an alert box with a checkbutton,
+ * (typically for things like "dont show this warning again")
+ */
+NS_IMETHODIMP CPromptService::AlertCheck (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text,
+ const PRUnichar *checkMsg,
+ PRBool *checkValue)
+{
+ GtkWidget *dialog;
+ GtkWidget *gparent;
+ GtkWidget *check_button;
+
+ gparent = MozillaFindGtkParent (parent);
+ const nsACString &msg = NS_ConvertUCS2toUTF8 (text);
+ dialog = gtk_message_dialog_new (GTK_WINDOW(gparent),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "%s",
+ PromiseFlatCString(msg).get ());
+
+ check_button = gtk_check_button_new_with_label ("");
+ gtk_widget_show (check_button);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
+ check_button, FALSE, FALSE, 5);
+ set_check_button_text (check_button, checkMsg);
+ set_check_button (check_button, checkValue);
+
+ set_title (dialog, dialogTitle);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ get_check_button (check_button, checkValue);
+ gtk_widget_destroy (dialog);
+
+ return NS_OK;
+}
+
+/**
+ * CPromptService::Confirm: for simple yes/no dialogs
+ */
+NS_IMETHODIMP CPromptService::Confirm (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text,
+ PRBool *_retval)
+{
+ GtkWidget *dialog;
+ GtkWidget *gparent;
+ int res;
+
+ gparent = MozillaFindGtkParent (parent);
+ const nsACString &msg = NS_ConvertUCS2toUTF8 (text);
+ dialog = gtk_message_dialog_new (GTK_WINDOW(gparent),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "%s", PromiseFlatCString(msg).get ());
+ set_title (dialog, dialogTitle);
+
+ res = gtk_dialog_run (GTK_DIALOG (dialog));
+ *_retval = (res == GTK_RESPONSE_YES);
+ gtk_widget_destroy (dialog);
+
+ return NS_OK;
+}
+
+/**
+ * CPromptService::Confirm: for simple yes/no dialogs, with an additional
+ * check button
+ */
+NS_IMETHODIMP CPromptService::ConfirmCheck (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text,
+ const PRUnichar *checkMsg,
+ PRBool *checkValue,
+ PRBool *_retval)
+{
+ GtkWidget *dialog;
+ GtkWidget *gparent;
+ GtkWidget *check_button;
+ int res;
+
+ gparent = MozillaFindGtkParent (parent);
+ const nsACString &msg = NS_ConvertUCS2toUTF8 (text);
+ dialog = gtk_message_dialog_new (GTK_WINDOW(gparent),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "%s", PromiseFlatCString(msg).get ());
+
+ check_button = gtk_check_button_new_with_label ("");
+ gtk_widget_show (check_button);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
+ check_button, FALSE, FALSE, 5);
+ set_check_button_text (check_button, checkMsg);
+ set_check_button (check_button, checkValue);
+
+ set_title (dialog, dialogTitle);
+
+ res = gtk_dialog_run (GTK_DIALOG (dialog));
+ *_retval = (res == GTK_RESPONSE_YES);
+ get_check_button (check_button, checkValue);
+ gtk_widget_destroy (dialog);
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP CPromptService::AddButton (GtkWidget *dialog,
+ char type,
+ const PRUnichar *title,
+ int id)
+{
+ const char *btitle;
+ const nsACString &utf8string = NS_ConvertUCS2toUTF8 (title);
+
+ g_print ("%d", type);
+
+ switch (type)
+ {
+ case BUTTON_TITLE_OK:
+ btitle = GTK_STOCK_OK;
+ break;
+ case BUTTON_TITLE_CANCEL:
+ btitle = GTK_STOCK_CANCEL;
+ break;
+ case BUTTON_TITLE_YES:
+ btitle = GTK_STOCK_YES;
+ break;
+ case BUTTON_TITLE_NO:
+ btitle = GTK_STOCK_NO;
+ break;
+ case BUTTON_TITLE_SAVE:
+ btitle = _("Save");
+ break;
+ case BUTTON_TITLE_REVERT:
+ btitle = _("Revert");
+ break;
+ case BUTTON_TITLE_DONT_SAVE:
+ btitle = _("Don't save");
+ break;
+ case BUTTON_TITLE_IS_STRING:
+ btitle = NULL;
+ break;
+
+ default:
+ return NS_ERROR_FAILURE;
+ }
+
+ gtk_dialog_add_button (GTK_DIALOG(dialog),
+ btitle ? btitle :
+ PromiseFlatCString(utf8string).get(),
+ id);
+
+ return NS_OK;
+}
+
+/**
+ * CPromptService::ConfirmEx: For fancy confirmation dialogs
+ */
+NS_IMETHODIMP CPromptService::ConfirmEx (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text,
+ PRUint32 buttonFlags,
+ const PRUnichar *button0Title,
+ const PRUnichar *button1Title,
+ const PRUnichar *button2Title,
+ const PRUnichar *checkMsg,
+ PRBool *checkValue,
+ PRInt32 *buttonPressed)
+{
+ GtkWidget *dialog;
+ GtkWidget *gparent;
+ GtkWidget *check_button = NULL;
+ int ret;
+
+ gparent = MozillaFindGtkParent (parent);
+ const nsACString &msg = NS_ConvertUCS2toUTF8 (text);
+ dialog = gtk_message_dialog_new (GTK_WINDOW(gparent),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ "%s", PromiseFlatCString(msg).get ());
+
+ set_title (dialog, dialogTitle);
+
+ if (checkMsg)
+ {
+ check_button = gtk_check_button_new_with_label ("");
+ gtk_widget_show (check_button);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
+ check_button, FALSE, FALSE, 5);
+
+ set_check_button_text (check_button, checkMsg);
+ set_check_button (check_button, checkValue);
+ }
+
+ AddButton (dialog, (buttonFlags >> 16) & 0xFF,
+ button2Title, 2);
+ AddButton (dialog, (buttonFlags >> 8) & 0xFF,
+ button1Title, 1);
+ AddButton (dialog, buttonFlags & 0xFF,
+ button0Title, 0);
+
+ gtk_dialog_set_default_response (GTK_DIALOG(dialog), 0);
+
+ /* make a suitable sound */
+ gnome_triggers_vdo ("", "generic", NULL);
+
+ /* run dialog and capture return values */
+ ret = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ /* handle return values */
+ if (checkMsg)
+ {
+ get_check_button (check_button, checkValue);
+ }
+
+ *buttonPressed = ret;
+
+ /* done */
+ gtk_widget_destroy (dialog);
+ return NS_OK;
+}
+
+/**
+ * CPromptService::Prompt: show a prompt for text, with a checkbutton
+ */
+NS_IMETHODIMP CPromptService::Prompt (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text,
+ PRUnichar **value,
+ const PRUnichar *checkMsg,
+ PRBool *checkValue,
+ PRBool *_retval)
+{
+ GtkWidget *dialog;
+ GtkWidget *entry;
+ GtkWidget *label;
+ GtkWidget *check_button;
+ GtkWidget *gparent;
+ GladeXML *gxml;
+ gint ret;
+
+ /* build and show the dialog */
+ gxml = ephy_glade_widget_new ("prompts.glade", "prompt_dialog",
+ &dialog, NULL);
+ entry = glade_xml_get_widget (gxml, "entry");
+ label = glade_xml_get_widget (gxml, "label");
+ check_button = glade_xml_get_widget (gxml, "check_button");
+ g_object_unref (G_OBJECT (gxml));
+
+ /* parent the dialog */
+ gparent = MozillaFindGtkParent (parent);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (gparent));
+
+ /* set dynamic attributes */
+ set_title (dialog, dialogTitle);
+ set_label_text (label, text);
+ set_check_button_text (check_button, checkMsg);
+ set_editable (entry, value);
+ set_check_button (check_button, checkValue);
+ set_check_button_size_to_label (check_button, label);
+
+ /* make a suitable sound */
+ /* NB: should be question, but this is missing in many
+ * of the current gnome sound packages that I've tried... */
+ gnome_triggers_vdo ("", "generic", NULL);
+
+ /* run dialog and capture return values */
+ ret = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ /* handle return values */
+ get_check_button (check_button, checkValue);
+ get_editable (entry, value);
+ *_retval = (ret == GTK_RESPONSE_OK);
+
+ /* done */
+ gtk_widget_destroy (dialog);
+ return NS_OK;
+}
+
+/**
+ * CPromptService::PromptUsernameAndPassword: show a prompt for username
+ * and password with an additional check button.
+ */
+NS_IMETHODIMP CPromptService::PromptUsernameAndPassword
+ (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text,
+ PRUnichar **username,
+ PRUnichar **password,
+ const PRUnichar *checkMsg,
+ PRBool *checkValue,
+ PRBool *_retval)
+{
+ GtkWidget *dialog;
+ GtkWidget *check_button;
+ GtkWidget *label;
+ GtkWidget *username_entry;
+ GtkWidget *password_entry;
+ GtkWidget *gparent;
+ GladeXML *gxml;
+ gint ret;
+
+ /* build and show the dialog */
+ gxml = ephy_glade_widget_new ("prompts.glade", "prompt_user_pass_dialog",
+ &dialog, NULL);
+ check_button = glade_xml_get_widget (gxml, "check_button");
+ label = glade_xml_get_widget (gxml, "label");
+ username_entry = glade_xml_get_widget (gxml, "username_entry");
+ password_entry = glade_xml_get_widget (gxml, "password_entry");
+ g_object_unref (G_OBJECT (gxml));
+
+ /* parent the dialog */
+ gparent = MozillaFindGtkParent (parent);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (gparent));
+
+ /* set dynamic attributes */
+ set_title (dialog, dialogTitle);
+ set_check_button_text (check_button, checkMsg);
+ set_editable (username_entry, username);
+ set_editable (password_entry, password);
+ set_check_button (check_button, checkValue);
+ set_label_text (label, text);
+ set_check_button_size_to_label (check_button, label);
+
+ /* make a suitable sound */
+ gnome_triggers_vdo ("", "question", NULL);
+
+ /* run dialog and capture return values */
+ ret = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ /* handle return values */
+ get_check_button (check_button, checkValue);
+ get_editable (username_entry, username);
+ get_editable (password_entry, password);
+ *_retval = (ret == GTK_RESPONSE_OK);
+
+ /* done */
+ gtk_widget_destroy (dialog);
+ return NS_OK;
+}
+
+/**
+ * CPromptService::PromptPassword: show a prompt for just
+ * a password with an additional check button.
+ */
+NS_IMETHODIMP CPromptService::PromptPassword (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text,
+ PRUnichar **password,
+ const PRUnichar *checkMsg,
+ PRBool *checkValue,
+ PRBool *_retval)
+{
+ GtkWidget *dialog;
+ GtkWidget *label;
+ GtkWidget *check_button;
+ GtkWidget *password_entry;
+ GtkWidget *gparent;
+ GladeXML *gxml;
+ gint ret;
+
+ /* build and show the dialog */
+ gxml = ephy_glade_widget_new ("prompts.glade", "prompt_pass_dialog",
+ &dialog, NULL);
+ check_button = glade_xml_get_widget (gxml, "check_button");
+ label = glade_xml_get_widget (gxml, "label");
+ password_entry = glade_xml_get_widget (gxml, "password_entry");
+ g_object_unref (G_OBJECT (gxml));
+
+ /* parent the dialog */
+ gparent = MozillaFindGtkParent (parent);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (gparent));
+
+ /* set dynamic attributes */
+ set_title (dialog, dialogTitle);
+ set_check_button_text (check_button, checkMsg);
+ set_editable (password_entry, password);
+ set_check_button (check_button, checkValue);
+ set_label_text (label, text);
+ set_check_button_size_to_label (check_button, label);
+
+ /* make a suitable sound */
+ gnome_triggers_vdo ("", "question", NULL);
+
+ /* run dialog and capture return values */
+ ret = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ /* handle return values */
+ get_check_button (check_button, checkValue);
+ get_editable (password_entry, password);
+ *_retval = (ret == GTK_RESPONSE_OK);
+
+ /* done */
+ gtk_widget_destroy (dialog);
+ return NS_OK;
+}
+
+
+/**
+ * CPromptService::Select:
+ */
+NS_IMETHODIMP CPromptService::Select (nsIDOMWindow *parent,
+ const PRUnichar *dialogTitle,
+ const PRUnichar *text, PRUint32 count,
+ const PRUnichar **selectList,
+ PRInt32 *outSelection,
+ PRBool *_retval)
+{
+ GtkWidget *dialog;
+ GtkWidget *gparent;
+ GtkWidget *label;
+ GladeXML *gxml;
+ GtkWidget *treeview;
+ gint ret;
+
+ /* build and show the dialog */
+ gxml = ephy_glade_widget_new ("prompts.glade", "select_dialog",
+ &dialog, NULL);
+ treeview = glade_xml_get_widget (gxml, "treeview");
+ label = glade_xml_get_widget (gxml, "label");
+ g_object_unref (G_OBJECT (gxml));
+
+ /* parent the dialog */
+ gparent = MozillaFindGtkParent (parent);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (gparent));
+
+ /* set dynamic attributes */
+ set_title (dialog, dialogTitle);
+ set_label_text (label, text);
+
+ /* setup treeview */
+ GtkCellRenderer *renderer;
+ GtkListStore *liststore;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ gtk_tree_view_set_reorderable (GTK_TREE_VIEW(treeview), TRUE);
+
+ liststore = gtk_list_store_new (2,
+ G_TYPE_STRING,
+ G_TYPE_INT);
+
+ model = GTK_TREE_MODEL (liststore);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW(treeview),
+ model);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(treeview),
+ FALSE);
+
+ renderer = gtk_cell_renderer_text_new ();
+
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview),
+ 0, "Items",
+ renderer,
+ "text", 0,
+ NULL);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(treeview));
+
+ for (PRUint32 i = 0 ; i < count ; i++)
+ {
+ char *itemText =
+ ToNewCString(NS_ConvertUCS2toUTF8 (selectList[i]));
+ gtk_list_store_append (GTK_LIST_STORE (model),
+ &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model),
+ &iter,
+ 0, itemText,
+ 1, i,
+ -1);
+ nsMemory::Free(itemText);
+ }
+
+ gtk_tree_model_get_iter_first (model, &iter);
+ gtk_tree_selection_select_iter (selection, &iter);
+
+ /* make a suitable sound */
+ gnome_triggers_vdo ("", "question", NULL);
+
+ /* run dialog and capture return values */
+ ret = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ /* handle return values */
+ if (gtk_tree_selection_get_selected (selection,
+ &model,
+ &iter))
+ {
+ GValue val = {0, };
+ gtk_tree_model_get_value (model, &iter, 1, &val);
+ *outSelection = g_value_get_int (&val);
+
+ *_retval = (ret == GTK_RESPONSE_OK) ? PR_TRUE : PR_FALSE;
+ }
+ else
+ {
+ *_retval = PR_FALSE;
+ }
+
+ gtk_widget_destroy (dialog);
+
+ return NS_OK;
+}
+
+NS_DEF_FACTORY (CPromptService, CPromptService);
+
+/**
+ * NS_NewPromptServiceFactory:
+ */
+nsresult NS_NewPromptServiceFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsCPromptServiceFactory *result = new nsCPromptServiceFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
+
+/**
+ * set_title: set a dialog title to a unicode string
+ */
+static void
+set_title (GtkWidget *dialog, const PRUnichar *title)
+{
+ const nsACString &utf8string = NS_ConvertUCS2toUTF8 (title);
+
+ /* set it */
+ gtk_window_set_title (GTK_WINDOW (dialog),
+ (title == NULL ? N_("Galeon") :
+ PromiseFlatCString(utf8string).get()));
+}
+
+/**
+ * set_label_text: set a labels text to a unicode string
+ */
+static void
+set_label_text (GtkWidget *label, const PRUnichar *text)
+{
+ const nsACString &utf8string = NS_ConvertUCS2toUTF8 (text);
+
+ /* set it */
+ gtk_label_set_text (GTK_LABEL (label),
+ PromiseFlatCString(utf8string).get());
+}
+
+/**
+ * set_check_button_text: set a check buttons text to a unicode string
+ */
+static void
+set_check_button_text (GtkWidget *check_button, const PRUnichar *text)
+{
+ const nsACString &utf8string = NS_ConvertUCS2toUTF8 (text);
+
+ /* set it */
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (check_button)->child),
+ PromiseFlatCString(utf8string).get());
+}
+
+/**
+ * set_check_button: set a togglebutton to an initial state
+ */
+static void
+set_check_button (GtkWidget *button, PRBool *value)
+{
+ /* check pointer is valid */
+ if (value == NULL)
+ {
+ gtk_widget_hide (GTK_WIDGET (button));
+ return;
+ }
+
+ /* set the value of the check button */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), *value);
+}
+
+/**
+ * se_check_button_size_to_label: sync text widgets sizes
+ */
+static void
+set_check_button_size_to_label (GtkWidget *check_button,
+ GtkWidget *label)
+{
+ GtkRequisition r, label_r;
+
+ gtk_widget_size_request (check_button, &r);
+ gtk_widget_size_request (label, &label_r);
+
+ if (r.width <= label_r.width) return;
+
+ gtk_widget_set_size_request (label, r.width, 0);
+}
+
+/**
+ * set_editable: set an editable to a unicode string
+ */
+static void
+set_editable (GtkWidget *entry, PRUnichar **text)
+{
+ const nsACString &utf8string = NS_ConvertUCS2toUTF8 (*text);
+
+ /* set this string value in the widget */
+ gtk_entry_set_text (GTK_ENTRY (entry),
+ PromiseFlatCString(utf8string).get());
+}
+
+/**
+ * get_check_button: get value of a toggle button and store it in a PRBool
+ */
+static void
+get_check_button (GtkWidget *button, PRBool *value)
+{
+ /* check we can write */
+ if (value == NULL)
+ {
+ return;
+ }
+
+ /* set the value from the check button */
+ *value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+}
+
+/**
+ * get_editable: get a string from an editable and store it as unicode
+ */
+static void
+get_editable (GtkWidget *editable, PRUnichar **text)
+{
+ char *edited;
+
+ /* check we can write */
+ if (text == NULL)
+ {
+ return;
+ }
+
+ /* get the text */
+ edited = gtk_editable_get_chars (GTK_EDITABLE (editable), 0, -1);
+
+ /* decode and set it as the return value */
+ *text = ToNewUnicode(NS_ConvertUTF8toUCS2(edited));
+}
diff --git a/embed/mozilla/PromptService.h b/embed/mozilla/PromptService.h
new file mode 100644
index 000000000..98d8d0c46
--- /dev/null
+++ b/embed/mozilla/PromptService.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PromptService_h
+#define __PromptService_h
+
+#include "nsError.h"
+
+#define G_PROMPTSERVICE_CID \
+{ /* c5a77759-a07a-4025-8f74-ae89153ee6c2 */ \
+ 0xc5a77759, \
+ 0xa07a, \
+ 0x4025, \
+ {0x8f, 0x74, 0xae, 0x89, 0x15, 0x3e, 0xe6, 0xc2} \
+}
+
+#define G_PROMPTSERVICE_CLASSNAME "Galeon's Prompt Service"
+#define G_PROMPTSERVICE_CONTRACTID "@mozilla.org/embedcomp/prompt-service;1"
+
+class nsIFactory;
+
+extern nsresult NS_NewPromptServiceFactory(nsIFactory** aFactory);
+
+#endif
diff --git a/embed/mozilla/StartHereProtocolHandler.cpp b/embed/mozilla/StartHereProtocolHandler.cpp
new file mode 100644
index 000000000..47a1af310
--- /dev/null
+++ b/embed/mozilla/StartHereProtocolHandler.cpp
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2001 Matt Aubury, Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-file-helpers.h"
+
+#include "nsCOMPtr.h"
+#include "nsIFactory.h"
+#include "nsIIOService.h"
+#include "nsIServiceManager.h"
+#include "nsIURI.h"
+#include "nsNetCID.h"
+#include "nsNetUtil.h"
+#include "nsXPComFactory.h"
+
+static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
+
+class GStartHereProtocolHandler : public nsIProtocolHandler
+{
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIPROTOCOLHANDLER
+
+ GStartHereProtocolHandler (void);
+ virtual ~GStartHereProtocolHandler();
+
+ nsCOMPtr<nsIChannel> mChannel;
+ nsCOMPtr<nsIURI> mURI;
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1 (GStartHereProtocolHandler, nsIProtocolHandler)
+
+GStartHereProtocolHandler::GStartHereProtocolHandler (void)
+{
+ NS_INIT_ISUPPORTS();
+
+}
+
+GStartHereProtocolHandler::~GStartHereProtocolHandler()
+{
+ /* destructor code */
+}
+
+/* readonly attribute string scheme; */
+NS_IMETHODIMP GStartHereProtocolHandler::GetScheme(nsACString &aScheme)
+{
+ aScheme = NS_LITERAL_CSTRING("start-here");
+ return NS_OK;
+}
+
+/* readonly attribute long defaultPort; */
+NS_IMETHODIMP GStartHereProtocolHandler::GetDefaultPort(PRInt32 *aDefaultPort)
+{
+ nsresult rv = NS_OK;
+ if (aDefaultPort)
+ *aDefaultPort = -1;
+ else
+ rv = NS_ERROR_NULL_POINTER;
+ return rv;
+}
+
+/* readonly attribute short protocolFlags; */
+NS_IMETHODIMP GStartHereProtocolHandler::GetProtocolFlags(PRUint32 *aProtocolFlags)
+{
+ if (aProtocolFlags)
+ *aProtocolFlags = nsIProtocolHandler::URI_STD;
+ else
+ return NS_ERROR_NULL_POINTER;
+ return NS_OK;
+}
+
+/* nsIURI newURI (in string aSpec, in nsIURI aBaseURI); */
+NS_IMETHODIMP GStartHereProtocolHandler::NewURI(const nsACString &aSpec,
+ const char *aOriginCharset,
+ nsIURI *aBaseURI,
+ nsIURI **_retval)
+{
+ nsresult rv = NS_OK;
+ nsCOMPtr <nsIURI> newUri;
+
+ rv = nsComponentManager::CreateInstance(kSimpleURICID, NULL,
+ NS_GET_IID(nsIURI),
+ getter_AddRefs(newUri));
+
+ if (NS_SUCCEEDED(rv))
+ {
+ newUri->SetSpec(aSpec);
+ rv = newUri->QueryInterface(NS_GET_IID(nsIURI),
+ (void **) _retval);
+ }
+ return rv;
+}
+
+/* nsIChannel newChannel (in nsIURI aURI); */
+NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
+ nsIChannel **_retval)
+{
+ nsresult rv;
+
+ nsCAutoString path;
+ rv = aURI->GetPath(path);
+ if (NS_FAILED(rv)) return rv;
+
+ char *httpSpec = g_strconcat ("file:///",
+ ephy_file ("start_here.html"),
+ NULL);
+
+ if (!httpSpec) return NS_ERROR_OUT_OF_MEMORY;
+
+ nsCOMPtr<nsIIOService> serv(do_GetIOService(&rv));
+ if (NS_FAILED(rv)) return rv;
+
+ // now we have an HTTP url, give the user an HTTP channel
+ rv = serv->NewChannel(nsDependentCString(httpSpec), nsnull, nsnull, _retval);
+
+ return rv;
+}
+
+/* boolean allowPort (in long port, in string scheme); */
+NS_IMETHODIMP GStartHereProtocolHandler::AllowPort(PRInt32 port, const char *scheme,
+ PRBool *_retval)
+{
+ *_retval = PR_FALSE;
+ return NS_OK;
+}
+
+NS_DEF_FACTORY (GStartHereProtocolHandler, GStartHereProtocolHandler);
+
+/**
+ * NS_NewStartHereProtocolHandlerFactory:
+ */
+nsresult NS_NewStartHereHandlerFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ nsGStartHereProtocolHandlerFactory *result = new nsGStartHereProtocolHandlerFactory;
+ if (result == NULL)
+ {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
diff --git a/embed/mozilla/StartHereProtocolHandler.h b/embed/mozilla/StartHereProtocolHandler.h
new file mode 100644
index 000000000..82c74774b
--- /dev/null
+++ b/embed/mozilla/StartHereProtocolHandler.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2001 Philip Langdale
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef StartHereProtocolHandler_h__
+#define StartHereProtocolHandler_h__
+
+#include "nsError.h"
+
+#define G_START_HERE_PROTOCOLHANDLER_CID \
+{ /* a3a7b6e5-7a92-431d-87e6-3bef8e7ada51*/ \
+ 0xa3a7b6e5, \
+ 0x7a92, \
+ 0x431d, \
+ {0x87, 0xe6, 0x3b, 0xef, 0x8e, 0x7a, 0xda, 0x51} \
+}
+#define G_START_HERE_PROTOCOLHANDLER_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "start-here"
+#define G_START_HERE_PROTOCOLHANDLER_CLASSNAME "Galeon's start here protocol handler"
+
+class nsIFactory;
+
+extern nsresult NS_NewStartHereHandlerFactory(nsIFactory** aFactory);
+
+#endif // MyportalProtocolHandler_h__
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
new file mode 100644
index 000000000..abfcacd57
--- /dev/null
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ProgressListener.h"
+#include "EphyWrapper.h"
+#include "mozilla-embed.h"
+#include "mozilla-embed-persist.h"
+
+#include <stddef.h>
+#include <nsIWebBrowserPersist.h>
+#include <nsString.h>
+#include <nsCWebBrowserPersist.h>
+#include <nsNetUtil.h>
+
+static void
+mozilla_embed_persist_class_init (MozillaEmbedPersistClass *klass);
+static void
+mozilla_embed_persist_init (MozillaEmbedPersist *ges);
+static void
+mozilla_embed_persist_finalize (GObject *object);
+
+static gresult
+impl_save (EphyEmbedPersist *persist);
+
+struct MozillaEmbedPersistPrivate
+{
+ gpointer dummy;
+};
+
+static GObjectClass *parent_class = NULL;
+
+GType
+mozilla_embed_persist_get_type (void)
+{
+ static GType mozilla_embed_persist_type = 0;
+
+ if (mozilla_embed_persist_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (MozillaEmbedPersistClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) mozilla_embed_persist_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (MozillaEmbedPersist),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mozilla_embed_persist_init
+ };
+
+ mozilla_embed_persist_type =
+ g_type_register_static (EPHY_EMBED_PERSIST_TYPE,
+ "MozillaEmbedPersist",
+ &our_info, (GTypeFlags)0);
+ }
+
+ return mozilla_embed_persist_type;
+}
+
+static void
+mozilla_embed_persist_class_init (MozillaEmbedPersistClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EphyEmbedPersistClass *persist_class;
+
+ parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
+ persist_class = EPHY_EMBED_PERSIST_CLASS (klass);
+
+ object_class->finalize = mozilla_embed_persist_finalize;
+
+ persist_class->save = impl_save;
+}
+
+static void
+mozilla_embed_persist_init (MozillaEmbedPersist *persist)
+{
+ persist->priv = g_new0 (MozillaEmbedPersistPrivate, 1);
+}
+
+static void
+mozilla_embed_persist_finalize (GObject *object)
+{
+ MozillaEmbedPersist *persist;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_MOZILLA_EMBED_PERSIST (object));
+
+ persist = MOZILLA_EMBED_PERSIST (object);
+
+ g_return_if_fail (persist->priv != NULL);
+
+ g_free (persist->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gresult
+impl_save (EphyEmbedPersist *persist)
+{
+ nsresult rv;
+ nsAutoString s;
+ char *filename;
+ char *uri;
+ int max_size;
+ EphyEmbed *embed;
+ EmbedPersistFlags flags;
+ EphyWrapper *wrapper = NULL;
+
+ g_object_get (persist,
+ "source", &uri,
+ "dest", &filename,
+ "flags", &flags,
+ "embed", &embed,
+ "max_size", &max_size,
+ NULL);
+
+ g_return_val_if_fail (filename != NULL, G_FAILED);
+
+ nsCOMPtr<nsIURI> linkURI;
+ linkURI = nsnull;
+ if (uri)
+ {
+ s.AssignWithConversion(uri);
+ rv = NS_NewURI(getter_AddRefs(linkURI), s);
+ if (NS_FAILED(rv) || !linkURI) return G_FAILED;
+ }
+
+ nsCOMPtr<nsIWebBrowserPersist> bpersist =
+ do_CreateInstance(NS_WEBBROWSERPERSIST_CONTRACTID, &rv);
+ if (NS_FAILED(rv) || !persist) return G_FAILED;
+
+ nsCOMPtr<nsILocalFile> file;
+ NS_NewLocalFile(NS_ConvertUTF8toUCS2(filename), PR_TRUE, getter_AddRefs(file));
+ if (NS_FAILED(rv) || !file) return G_FAILED;
+
+ nsCOMPtr<nsILocalFile> path;
+ if (flags & EMBED_PERSIST_SAVE_CONTENT)
+ {
+ char *datapath;
+ datapath = g_strconcat (filename, "content", NULL);
+ NS_NewLocalFile(NS_ConvertUTF8toUCS2(datapath), PR_TRUE, getter_AddRefs(path));
+ g_free (datapath);
+ }
+ else
+ {
+ path = nsnull;
+ }
+
+ nsCOMPtr<nsIDOMWindow> parent;
+ parent = nsnull;
+
+ if (embed)
+ {
+ wrapper = (EphyWrapper *) mozilla_embed_get_galeon_wrapper (MOZILLA_EMBED(embed));
+ wrapper->GetDOMWindow (getter_AddRefs (parent));
+ }
+
+ size_t len = strlen(filename);
+ if((filename[len-1] == 'z' && filename[len-2] == 'g') ||
+ (filename[len-1] == 'Z' && filename[len-2] == 'G'))
+ {
+ bpersist->SetPersistFlags (nsIWebBrowserPersist::PERSIST_FLAGS_NO_CONVERSION);
+ }
+ else
+ {
+ bpersist->SetPersistFlags (nsIWebBrowserPersist::PERSIST_FLAGS_NONE);
+ }
+
+ if (flags & EMBED_PERSIST_BYPASSCACHE)
+ {
+ bpersist->SetPersistFlags (nsIWebBrowserPersist::PERSIST_FLAGS_BYPASS_CACHE);
+ }
+
+ if (flags & EMBED_PERSIST_FROMCACHE)
+ {
+ bpersist->SetPersistFlags (nsIWebBrowserPersist::PERSIST_FLAGS_FROM_CACHE);
+ }
+
+ GProgressListener *aProgress = new GProgressListener ();
+
+ if (uri == NULL)
+ {
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ nsCOMPtr<nsIDOMDocument> DOMDocument;
+
+ if (flags & EMBED_PERSIST_MAINDOC)
+ {
+ rv = wrapper->GetMainDOMDocument (getter_AddRefs(DOMDocument));
+ }
+ else
+ {
+ rv = wrapper->GetDOMDocument (getter_AddRefs(DOMDocument));
+ }
+ if (NS_FAILED(rv) || !DOMDocument) return G_FAILED;
+
+ nsCOMPtr<nsIDocument> document =
+ do_QueryInterface (DOMDocument, &rv);
+ if (NS_FAILED(rv) || !document) return G_FAILED;
+
+ nsCOMPtr<nsIURI> uri;
+ rv = document->GetDocumentURL (getter_AddRefs(uri));
+ if (NS_FAILED(rv) || !uri) return G_FAILED;
+
+ aProgress->InitForPersist (bpersist, parent,
+ uri, file,
+ ACTION_OBJECT_NOTIFY,
+ persist,
+ !(flags & EMBED_PERSIST_SHOW_PROGRESS));
+
+ rv = bpersist->SaveDocument (DOMDocument, file, path, nsnull, 0, 0);
+ if (NS_FAILED(rv)) return G_FAILED;
+ }
+ else
+ {
+ aProgress->InitForPersist (bpersist, parent,
+ linkURI, file,
+ ACTION_OBJECT_NOTIFY,
+ persist,
+ !(flags & EMBED_PERSIST_SHOW_PROGRESS));
+
+ rv = bpersist->SaveURI (linkURI, nsnull, file);
+ if (NS_FAILED(rv)) return G_FAILED;
+ }
+
+ return G_OK;
+}
+
diff --git a/embed/mozilla/mozilla-embed-persist.h b/embed/mozilla/mozilla-embed-persist.h
new file mode 100644
index 000000000..bcd073ca3
--- /dev/null
+++ b/embed/mozilla/mozilla-embed-persist.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MOZILLA_EMBED_PERSIST_H
+#define MOZILLA_EMBED_PERSIST_H
+
+#include "ephy-embed-persist.h"
+
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct MozillaEmbedPersistClass MozillaEmbedPersistClass;
+
+#define MOZILLA_EMBED_PERSIST_TYPE (mozilla_embed_persist_get_type ())
+#define MOZILLA_EMBED_PERSIST(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_PERSIST_TYPE, MozillaEmbedPersist))
+#define MOZILLA_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_PERSIST_TYPE, MozillaEmbedPersistClass))
+#define IS_MOZILLA_EMBED_PERSIST(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_PERSIST_TYPE))
+#define IS_MOZILLA_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED_PERSIST))
+#define MOZILLA_EMBED_PERSIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_PERSIST_TYPE, MozillaEmbedPersistClass))
+
+typedef struct MozillaEmbedPersist MozillaEmbedPersist;
+typedef struct MozillaEmbedPersistPrivate MozillaEmbedPersistPrivate;
+
+struct MozillaEmbedPersist
+{
+ EphyEmbedPersist parent;
+ MozillaEmbedPersistPrivate *priv;
+};
+
+struct MozillaEmbedPersistClass
+{
+ EphyEmbedPersistClass parent_class;
+};
+
+GType mozilla_embed_persist_get_type (void);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/mozilla/mozilla-embed-shell.cpp b/embed/mozilla/mozilla-embed-shell.cpp
new file mode 100644
index 000000000..00b3c390d
--- /dev/null
+++ b/embed/mozilla/mozilla-embed-shell.cpp
@@ -0,0 +1,1106 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "glib.h"
+#include "ephy-string.h"
+#include "gtkmozembed.h"
+#include "mozilla-embed-shell.h"
+#include "mozilla-prefs.h"
+#include "ephy-prefs.h"
+#include "ephy-file-helpers.h"
+#include "mozilla-notifiers.h"
+#include "mozilla-i18n.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-embed-prefs.h"
+#include "MozRegisterComponents.h"
+#include "FilePicker.h"
+
+#include <time.h>
+#include <libgnome/gnome-i18n.h>
+#include <string.h>
+#include <nsICacheService.h>
+#include <nsCOMPtr.h>
+#include <nsNetCID.h>
+#include <nsIServiceManager.h>
+#include <nsIIOService.h>
+#include <nsIProtocolProxyService.h>
+#include <nsIJVMManager.h>
+#include <nsIAtom.h>
+#include <nsICharsetConverterManager.h>
+#include <nsICharsetConverterManager2.h>
+#include <nsIFontList.h>
+#include <nsISupportsPrimitives.h>
+#include <nsReadableUtils.h>
+#include <nsIPermissionManager.h>
+#include <nsICookieManager.h>
+#include <nsIPermission.h>
+#include <nsIPasswordManager.h>
+#include <nsIPassword.h>
+#include <nsICookie.h>
+#include <nsCCookieManager.h>
+#include <nsCPasswordManager.h>
+
+#define MOZILLA_PROFILE_DIR "/mozilla"
+#define MOZILLA_PROFILE_NAME "epiphany"
+#define MOZILLA_PROFILE_FILE "prefs.js"
+
+static void
+mozilla_embed_shell_class_init (MozillaEmbedShellClass *klass);
+static void
+mozilla_embed_shell_init (MozillaEmbedShell *ges);
+static void
+mozilla_embed_shell_finalize (GObject *object);
+
+static void
+impl_get_capabilities (EphyEmbedShell *shell,
+ EmbedShellCapabilities *caps);
+static gresult
+impl_clear_cache (EphyEmbedShell *shell,
+ CacheType type);
+static gresult
+impl_set_offline_mode (EphyEmbedShell *shell,
+ gboolean offline);
+static gresult
+impl_load_proxy_autoconf (EphyEmbedShell *shell,
+ const char* url);
+static gresult
+impl_get_charset_titles (EphyEmbedShell *shell,
+ const char *group,
+ GList **charsets);
+static gresult
+impl_get_charset_groups (EphyEmbedShell *shell,
+ GList **groups);
+static gresult
+impl_get_font_list (EphyEmbedShell *shell,
+ const char *langGroup,
+ const char *fontType,
+ GList **fontList,
+ char **default_font);
+static gresult
+impl_set_permission (EphyEmbedShell *shell,
+ const char *url,
+ PermissionType type,
+ gboolean allow);
+static gresult
+impl_list_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList **permissions);
+static gresult
+impl_remove_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList *permissions);
+static gresult
+impl_list_cookies (EphyEmbedShell *shell,
+ GList **cookies);
+static gresult
+impl_remove_cookies (EphyEmbedShell *shell,
+ GList *cookies);
+static gresult
+impl_list_passwords (EphyEmbedShell *shell,
+ PasswordType type,
+ GList **passwords);
+static gresult
+impl_remove_passwords (EphyEmbedShell *shell,
+ GList *passwords,
+ PasswordType type);
+static gresult
+impl_show_file_picker (EphyEmbedShell *shell,
+ GtkWidget *parentWidget,
+ const char *title,
+ const char *directory,
+ const char *file,
+ FilePickerMode mode,
+ char **ret_fullpath,
+ gboolean *ret_save_content,
+ FileFormat *file_formats,
+ int *ret_file_format);
+
+static void mozilla_embed_shell_new_window_orphan_cb (GtkMozEmbedSingle *embed,
+ GtkMozEmbed **retval,
+ guint chrome_mask,
+ EphyEmbedShell *shell);
+
+struct MozillaEmbedShellPrivate
+{
+ GHashTable *charsets_hash;
+ GList *sorted_charsets_titles;
+};
+
+static NS_DEFINE_CID(kJVMManagerCID, NS_JVMMANAGER_CID);
+
+static GObjectClass *parent_class = NULL;
+
+GType
+mozilla_embed_shell_get_type (void)
+{
+ static GType mozilla_embed_shell_type = 0;
+
+ if (mozilla_embed_shell_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (MozillaEmbedShellClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) mozilla_embed_shell_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (MozillaEmbedShell),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mozilla_embed_shell_init
+ };
+
+ mozilla_embed_shell_type = g_type_register_static (EPHY_EMBED_SHELL_TYPE,
+ "MozillaEmbedShell",
+ &our_info, (GTypeFlags)0);
+ }
+
+ return mozilla_embed_shell_type;
+}
+
+static void
+mozilla_embed_shell_class_init (MozillaEmbedShellClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EphyEmbedShellClass *shell_class;
+
+ parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
+ shell_class = EPHY_EMBED_SHELL_CLASS (klass);
+
+ object_class->finalize = mozilla_embed_shell_finalize;
+
+ shell_class->get_capabilities = impl_get_capabilities;
+ shell_class->clear_cache = impl_clear_cache;
+ shell_class->set_offline_mode = impl_set_offline_mode;
+ shell_class->load_proxy_autoconf = impl_load_proxy_autoconf;
+ shell_class->get_charset_titles = impl_get_charset_titles;
+ shell_class->get_charset_groups = impl_get_charset_groups;
+ shell_class->get_font_list = impl_get_font_list;
+ shell_class->set_permission = impl_set_permission;
+ shell_class->list_permissions = impl_list_permissions;
+ shell_class->remove_permissions = impl_remove_permissions;
+ shell_class->list_cookies = impl_list_cookies;
+ shell_class->remove_cookies = impl_remove_cookies;
+ shell_class->list_passwords = impl_list_passwords;
+ shell_class->remove_passwords = impl_remove_passwords;
+ shell_class->show_file_picker = impl_show_file_picker;
+}
+
+static void
+mozilla_load_proxy_prefs (MozillaEmbedShell *shell)
+{
+ char *tmp;
+ int i, mozilla_mode = 0;
+
+ /* Proxy mode */
+ tmp = eel_gconf_get_string (CONF_NETWORK_PROXY_MODE);
+ g_return_if_fail (tmp != NULL);
+
+ if (strcmp (tmp, "manual") == 0)
+ {
+ mozilla_mode = 1;
+ }
+ else if (strcmp (tmp, "auto") == 0)
+ {
+ mozilla_mode = 2;
+ }
+
+ mozilla_prefs_set_int ("network.proxy.type", mozilla_mode);
+ g_free (tmp);
+
+ /* Http proxy */
+ tmp = eel_gconf_get_string (CONF_NETWORK_HTTP_PROXY);
+ g_return_if_fail (tmp != NULL);
+ mozilla_prefs_set_string ("network.proxy.http", tmp);
+ g_free (tmp);
+
+ i = eel_gconf_get_integer (CONF_NETWORK_HTTP_PROXY_PORT);
+ mozilla_prefs_set_int ("network.proxy.http_port", i);
+
+ /* Ftp proxy */
+ tmp = eel_gconf_get_string (CONF_NETWORK_FTP_PROXY);
+ g_return_if_fail (tmp != NULL);
+ mozilla_prefs_set_string ("network.proxy.ftp", tmp);
+ g_free (tmp);
+
+ i = eel_gconf_get_integer (CONF_NETWORK_FTP_PROXY_PORT);
+ mozilla_prefs_set_int ("network.proxy.ftp_port", i);
+
+ /* Secure proxy */
+ tmp = eel_gconf_get_string (CONF_NETWORK_SSL_PROXY);
+ g_return_if_fail (tmp != NULL);
+ mozilla_prefs_set_string ("network.proxy.ssl", tmp);
+ g_free (tmp);
+
+ i = eel_gconf_get_integer (CONF_NETWORK_SSL_PROXY_PORT);
+ mozilla_prefs_set_int ("network.proxy.ssl_port", i);
+
+ /* Socks proxy */
+ tmp = eel_gconf_get_string (CONF_NETWORK_SOCKS_PROXY);
+ g_return_if_fail (tmp != NULL);
+ mozilla_prefs_set_string ("network.proxy.socks", tmp);
+ g_free (tmp);
+
+ i = eel_gconf_get_integer (CONF_NETWORK_SOCKS_PROXY_PORT);
+ mozilla_prefs_set_int ("network.proxy.socks_port", i);
+
+ /* Autoconfiguration */
+ tmp = eel_gconf_get_string (CONF_NETWORK_PROXY_AUTO_URL);
+ g_return_if_fail (tmp != NULL);
+ ephy_embed_shell_load_proxy_autoconf
+ (EPHY_EMBED_SHELL (shell), tmp);
+ g_free (tmp);
+}
+
+static void
+mozilla_set_default_prefs (void)
+{
+ mozilla_prefs_set_boolean ("mozilla.widget.raise-on-setfocus",
+ FALSE);
+ mozilla_prefs_set_boolean ("browser.display.use_system_colors",
+ FALSE);
+
+ /* set default search engine */
+ mozilla_prefs_set_string ("keyword.URL",_("http://www.google.com/search?q="));
+ mozilla_prefs_set_boolean ("keyword.enabled", TRUE);
+ mozilla_prefs_set_boolean ("security.checkloaduri", FALSE);
+
+ /* while we have no UI */
+ mozilla_prefs_set_boolean ("wallet.captureForms", FALSE);
+
+ /* deactivate mailcap and mime.types support */
+ mozilla_prefs_set_string ("helpers.global_mime_types_file", "");
+ mozilla_prefs_set_string ("helpers.global_mailcap_file", "");
+ mozilla_prefs_set_string ("helpers.private_mime_types_file", "");
+ mozilla_prefs_set_string ("helpers.private_mailcap_file", "");
+
+ /* dont allow xpi installs from epiphany, there are crashes */
+ mozilla_prefs_set_boolean ("xpinstall.enabled", FALSE);
+
+ /* disable sucky XUL ftp view, have nice ns4-like html page instead */
+ mozilla_prefs_set_boolean ("network.dir.generate_html", TRUE);
+
+ /* set the right accept encoding flags */
+ mozilla_prefs_set_string ("network.http.accept-encoding" ,
+ "gzip, deflate, compress;q=0.9");
+
+ mozilla_prefs_save ();
+}
+
+static void
+mozilla_init_single (MozillaEmbedShell *mes)
+{
+ GtkMozEmbedSingle *single;
+
+ /* get single */
+ single = gtk_moz_embed_single_get ();
+ if (single == NULL)
+ {
+ g_warning ("Failed to get singleton embed object!\n");
+ }
+
+ /* allow creation of orphan windows */
+ g_signal_connect (G_OBJECT (single), "new_window_orphan",
+ GTK_SIGNAL_FUNC (mozilla_embed_shell_new_window_orphan_cb),
+ mes);
+}
+
+static void
+mozilla_init_home (void)
+{
+ char *mozilla_five_home;
+ mozilla_five_home = g_strdup (g_getenv ("MOZILLA_FIVE_HOME"));
+ gtk_moz_embed_set_comp_path (mozilla_five_home);
+ g_free (mozilla_five_home);
+}
+
+void
+mozilla_init_profile (void)
+{
+ char *profile_path;
+ profile_path = g_build_filename (ephy_dot_dir (),
+ MOZILLA_PROFILE_DIR,
+ NULL);
+ gtk_moz_embed_set_profile_path (profile_path, MOZILLA_PROFILE_NAME);
+ g_free (profile_path);
+}
+
+static gboolean
+is_new_build (void)
+{
+ gboolean new_build = FALSE;
+ char *mozprefs, *build_test;
+
+ mozprefs = g_build_filename (ephy_dot_dir (),
+ MOZILLA_PROFILE_DIR,
+ MOZILLA_PROFILE_NAME,
+ MOZILLA_PROFILE_FILE,
+ NULL);
+
+ /* no mozilla prefs ? or new epiphany build */
+ build_test = eel_gconf_get_string ("/apps/epiphany/gconf_test");
+ if (!g_file_test(mozprefs, G_FILE_TEST_EXISTS) ||
+ build_test == NULL ||
+ strncmp (build_test, __TIME__, 8) != 0)
+ {
+ new_build = TRUE;
+ eel_gconf_set_string ("/apps/epiphany/gconf_test", __TIME__);
+ }
+
+ g_free (mozprefs);
+ g_free (build_test);
+
+ return new_build;
+}
+
+static void
+mozilla_init_prefs (void)
+{
+ mozilla_set_default_prefs ();
+ mozilla_notifiers_set_defaults ();
+}
+
+static gboolean
+have_gnome_url_handler (const gchar *protocol)
+{
+ gchar *key, *cmd;
+ gboolean rv;
+
+ key = g_strdup_printf ("/desktop/gnome/url-handlers/%s/command",
+ protocol);
+ cmd = eel_gconf_get_string (key);
+ g_free (key);
+
+ rv = (cmd != NULL);
+ g_free (cmd);
+
+ if (!rv) return rv;
+
+ key = g_strdup_printf ("/desktop/gnome/url-handlers/%s/enabled",
+ protocol);
+ rv = eel_gconf_get_boolean (key);
+ g_free (key);
+
+ return rv;
+}
+
+static void
+mozilla_register_external_protocols (void)
+{
+ /* FIXME register only when needed */
+ if (have_gnome_url_handler ("ftp"))
+ {
+ mozilla_register_FtpProtocolHandler ();
+ }
+ else
+ {
+ mozilla_unregister_FtpProtocolHandler ();
+ }
+
+ mozilla_register_MailtoProtocolHandler ();
+}
+
+static void
+mozilla_embed_shell_init (MozillaEmbedShell *mes)
+{
+ gboolean new_build;
+
+ mes->priv = g_new0 (MozillaEmbedShellPrivate, 1);
+
+ mes->priv->charsets_hash = NULL;
+ mes->priv->sorted_charsets_titles = NULL;
+
+ new_build = is_new_build ();
+
+ /* Pre initialization */
+ mozilla_notifiers_init (mes);
+ mozilla_init_home ();
+ mozilla_init_profile ();
+
+ /* Fire up the best */
+ gtk_moz_embed_push_startup ();
+
+ /* Post initialization */
+ if (new_build)
+ {
+ mozilla_init_prefs ();
+ }
+
+ mozilla_load_proxy_prefs (mes);
+
+ mozilla_init_single (mes);
+
+ mozilla_register_components ();
+
+ mozilla_register_external_protocols ();
+
+ /* FIXME alert if fails */
+}
+
+static void
+mozilla_embed_shell_new_window_orphan_cb (GtkMozEmbedSingle *embed,
+ GtkMozEmbed **retval,
+ guint chrome_mask,
+ EphyEmbedShell *shell)
+{
+ /* FIXME conversion duped in mozilla_embed */
+ EphyEmbed *new_embed;
+ int i;
+ EmbedChromeMask mask = EMBED_CHROME_OPENASPOPUP;
+
+ struct
+ {
+ guint chromemask;
+ EmbedChromeMask embed_mask;
+ }
+ conversion_map [] =
+ {
+ { GTK_MOZ_EMBED_FLAG_DEFAULTCHROME, EMBED_CHROME_DEFAULT },
+ { GTK_MOZ_EMBED_FLAG_MENUBARON, EMBED_CHROME_MENUBARON },
+ { GTK_MOZ_EMBED_FLAG_TOOLBARON, EMBED_CHROME_TOOLBARON },
+ { GTK_MOZ_EMBED_FLAG_STATUSBARON, EMBED_CHROME_STATUSBARON },
+ { GTK_MOZ_EMBED_FLAG_WINDOWRAISED, EMBED_CHROME_WINDOWRAISED },
+ { GTK_MOZ_EMBED_FLAG_WINDOWLOWERED, EMBED_CHROME_WINDOWLOWERED },
+ { GTK_MOZ_EMBED_FLAG_CENTERSCREEN, EMBED_CHROME_CENTERSCREEN },
+ { GTK_MOZ_EMBED_FLAG_OPENASDIALOG, EMBED_CHROME_OPENASDIALOG },
+ { GTK_MOZ_EMBED_FLAG_OPENASCHROME, EMBED_CHROME_OPENASCHROME },
+ { 0, EMBED_CHROME_NONE }
+ };
+
+ for (i = 0; conversion_map[i].chromemask != 0; i++)
+ {
+ if (chrome_mask & conversion_map[i].chromemask)
+ {
+ mask = (EmbedChromeMask) (mask | conversion_map[i].embed_mask);
+ }
+ }
+
+ g_signal_emit_by_name (shell, "new_window_orphan", &new_embed, mask);
+
+ g_assert (new_embed != NULL);
+
+ *retval = GTK_MOZ_EMBED(EPHY_EMBED(new_embed));
+}
+
+static void
+mozilla_embed_shell_finalize (GObject *object)
+{
+ MozillaEmbedShell *mes;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_MOZILLA_EMBED_SHELL (object));
+
+ mes = MOZILLA_EMBED_SHELL (object);
+
+ g_return_if_fail (mes->priv != NULL);
+
+ mozilla_notifiers_free ();
+
+ mozilla_prefs_save ();
+
+ gtk_moz_embed_pop_startup ();
+
+ g_free (mes->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+impl_get_capabilities (EphyEmbedShell *shell,
+ EmbedShellCapabilities *caps)
+{
+ EmbedShellCapabilities mycaps;
+
+ mycaps = (EmbedShellCapabilities)
+ (CACHE_CLEAR_CAP |
+ OFFLINE_CAP |
+ PROXY_AUTOCONF_CAP |
+ JAVA_CONSOLE_CAP |
+ JS_CONSOLE_CAP |
+ CHARSETS_CAP |
+ PERMISSIONS_CAP |
+ COOKIES_CAP |
+ PASSWORDS_CAP);
+
+ *caps = mycaps;
+}
+
+static gresult
+impl_clear_cache (EphyEmbedShell *shell,
+ CacheType type)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsICacheService> CacheService =
+ do_GetService (NS_CACHESERVICE_CONTRACTID, &rv);
+ if (NS_FAILED(rv)) return G_FAILED;
+
+ CacheService->EvictEntries((guint)type);
+
+ return G_OK;
+}
+
+static gresult
+impl_set_offline_mode (EphyEmbedShell *shell,
+ gboolean offline)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIIOService> io = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
+ if (NS_FAILED(rv))
+ return G_FAILED;
+
+ rv = io->SetOffline(offline);
+ if (NS_SUCCEEDED(rv)) return G_FAILED;
+
+ return G_OK;
+}
+
+static gresult
+impl_load_proxy_autoconf (EphyEmbedShell *shell,
+ const char* url)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIProtocolProxyService> pps =
+ do_GetService ("@mozilla.org/network/protocol-proxy-service;1",
+ &rv);
+ if (NS_FAILED(rv) || !pps) return G_FAILED;
+
+ rv = pps->ConfigureFromPAC (url);
+ if (NS_FAILED(rv)) return G_FAILED;
+
+ return G_OK;
+}
+
+static gresult
+fill_charsets_lists (MozillaEmbedShellPrivate *priv)
+{
+ nsresult rv;
+ char *tmp;
+ PRUint32 cscount;
+ PRUint32 translated_cscount = get_translated_cscount ();
+ char *charset_str, *charset_title_str;
+
+ nsCOMPtr<nsIAtom> docCharsetAtom;
+ nsCOMPtr<nsICharsetConverterManager2> ccm2 =
+ do_GetService (NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
+ if (!NS_SUCCEEDED(rv)) return G_FAILED;
+
+ nsCOMPtr <nsISupportsArray> cs_list;
+ rv = ccm2->GetDecoderList (getter_AddRefs(cs_list));
+ if (!NS_SUCCEEDED(rv)) return G_FAILED;
+
+ rv = cs_list->Count(&cscount);
+ priv->charsets_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ for (PRUint32 i = 0; i < cscount; i++)
+ {
+ nsCOMPtr<nsISupports> cssupports =
+ (dont_AddRef)(cs_list->ElementAt(i));
+ nsCOMPtr<nsIAtom> csatom ( do_QueryInterface(cssupports) );
+ nsAutoString charset_ns, charset_title_ns;
+
+ /* charset name */
+ rv = csatom->ToString(charset_ns);
+ tmp = ToNewCString (charset_ns);
+ if (tmp == NULL || strlen (tmp) == 0)
+ {
+ continue;
+ }
+ charset_str = g_strdup (tmp);
+ nsMemory::Free (tmp);
+ tmp = nsnull;
+
+ /* charset readable title */
+ rv = ccm2->GetCharsetTitle2(csatom, &charset_title_ns);
+ tmp = ToNewCString (charset_title_ns);
+ if (tmp == NULL ||
+ strlen (tmp) == 0)
+ {
+ if (tmp) nsMemory::Free (tmp);
+ charset_title_str = g_strdup (charset_str);
+ }
+ else
+ {
+ charset_title_str = g_strdup (tmp);
+ nsMemory::Free (tmp);
+ tmp = nsnull;
+ }
+
+ for (PRUint32 j = 0; j < translated_cscount; j++)
+ {
+ if (g_ascii_strcasecmp (
+ charset_str,
+ charset_trans_array[j].charset_name) == 0)
+ {
+ g_free (charset_title_str);
+ charset_title_str = (char *)
+ _(charset_trans_array[j].charset_title);
+ break;
+ }
+ }
+
+ /* fill the hash and the sorted list */
+ g_hash_table_insert (priv->charsets_hash, charset_title_str, charset_str);
+ priv->sorted_charsets_titles =
+ g_list_insert_sorted (priv->sorted_charsets_titles,
+ (gpointer)charset_title_str,
+ (GCompareFunc)g_ascii_strcasecmp);
+ }
+
+ return G_OK;
+}
+
+static void
+ensure_charsets_tables (MozillaEmbedShell *shell)
+{
+ if (!shell->priv->charsets_hash)
+ {
+ fill_charsets_lists (shell->priv);
+ }
+}
+
+static gresult
+impl_get_charset_titles (EphyEmbedShell *shell,
+ const char *group,
+ GList **charsets)
+{
+ MozillaEmbedShell *mshell = MOZILLA_EMBED_SHELL(shell);
+ int count = get_translated_cscount ();
+ GList *l = NULL;
+ int j;
+
+ ensure_charsets_tables (mshell);
+ g_return_val_if_fail (mshell->priv->charsets_hash != NULL, G_FAILED);
+
+ for (j = 0; j < count; j++)
+ {
+ if (group == NULL ||
+ strcmp (group, lgroups[charset_trans_array[j].lgroup]) == 0)
+ {
+ CharsetInfo *info;
+ info = g_new0 (CharsetInfo, 1);
+ info->name = charset_trans_array[j].charset_name;
+ info->title = charset_trans_array[j].charset_title;
+ l = g_list_append (l, info);
+
+ /* FIXME check that the encoding exists in mozilla before
+ * adding it */
+ }
+ }
+
+ *charsets = l;
+
+ return G_OK;
+}
+
+static gresult
+impl_get_charset_groups (EphyEmbedShell *shell,
+ GList **groups)
+{
+ GList *l = NULL;
+ int i;
+
+ for (i = 0; lgroups[i] != NULL; i++)
+ {
+ l = g_list_append (l, (gpointer)lgroups[i]);
+ }
+
+ *groups = l;
+
+ return G_OK;
+}
+
+static gresult
+impl_get_font_list (EphyEmbedShell *shell,
+ const char *langGroup,
+ const char *fontType,
+ GList **fontList,
+ char **default_font)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIFontList> mozFontList;
+ mozFontList = do_CreateInstance("@mozilla.org/gfx/fontlist;1", &rv);
+ if(NS_FAILED(rv)) return G_FAILED;
+
+ nsCOMPtr<nsISimpleEnumerator> fontEnum;
+ mozFontList->AvailableFonts(NS_ConvertUTF8toUCS2(langGroup).get(),
+ NS_ConvertUTF8toUCS2(fontType).get(),
+ getter_AddRefs(fontEnum));
+ if(NS_FAILED(rv)) return G_FAILED;
+
+ GList *l = NULL;
+ PRBool enumResult;
+ for(fontEnum->HasMoreElements(&enumResult) ;
+ enumResult == PR_TRUE;
+ fontEnum->HasMoreElements(&enumResult))
+ {
+ nsCOMPtr<nsISupportsString> fontName;
+ fontEnum->GetNext(getter_AddRefs(fontName));
+ if(NS_FAILED(rv)) return G_FAILED;
+
+ nsString fontString;
+ fontName->GetData(fontString);
+
+ char *gFontString;
+ gFontString = g_strdup(NS_ConvertUCS2toUTF8(fontString).get());
+ l = g_list_append(l, gFontString);
+ }
+ *fontList = l;
+
+ if (default_font != NULL)
+ {
+ char key [255];
+
+ sprintf (key, "font.name.%s.%s", fontType, langGroup);
+
+ *default_font = mozilla_prefs_get_string (key);
+ }
+
+ return G_OK;
+}
+
+static gresult
+impl_set_permission (EphyEmbedShell *shell,
+ const char *url,
+ PermissionType type,
+ gboolean allow)
+{
+ nsresult rv;
+ nsCOMPtr<nsIPermissionManager> permissionManager =
+ do_CreateInstance (NS_PERMISSIONMANAGER_CONTRACTID);
+
+ rv = permissionManager->Add (nsDependentCString(url),
+ allow ? PR_TRUE : PR_FALSE, type);
+ if (NS_FAILED(rv)) return G_FAILED;
+
+ return G_OK;
+}
+
+static gresult
+impl_list_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList **permissions)
+{
+ nsresult result;
+
+ *permissions = NULL;
+
+ nsCOMPtr<nsIPermissionManager> permissionManager =
+ do_CreateInstance (NS_PERMISSIONMANAGER_CONTRACTID);
+ nsCOMPtr<nsISimpleEnumerator> permissionEnumerator;
+ result = permissionManager->GetEnumerator (getter_AddRefs(permissionEnumerator));
+ if (NS_FAILED(result)) return G_FAILED;
+
+ PRBool enumResult;
+ for (permissionEnumerator->HasMoreElements(&enumResult) ;
+ enumResult == PR_TRUE ;
+ permissionEnumerator->HasMoreElements(&enumResult))
+ {
+ nsCOMPtr<nsIPermission> nsPermission;
+ result = permissionEnumerator->GetNext (getter_AddRefs(nsPermission));
+ if (NS_FAILED(result)) return G_FAILED;
+
+ PRInt32 cType;
+ nsPermission->GetType (&cType);
+ if (cType == type)
+ {
+ PermissionInfo *b = g_new0 (PermissionInfo, 1);
+ gchar *tmp = NULL;
+
+ nsPermission->GetHost (&tmp);
+ b->domain = g_strdup (tmp);
+ nsMemory::Free (tmp);
+
+ PRBool cap;
+ nsPermission->GetCapability (&cap);
+ if (cap == PR_TRUE)
+ b->type = g_strdup (_("Allowed"));
+ else
+ b->type = g_strdup (_("Blocked"));
+
+ *permissions = g_list_prepend (*permissions, b);
+ }
+ }
+
+ *permissions = g_list_reverse (*permissions);
+
+ return G_OK;
+}
+
+static gresult
+impl_remove_permissions (EphyEmbedShell *shell,
+ PermissionType type,
+ GList *permissions)
+{
+ nsresult result;
+ nsCOMPtr<nsIPermissionManager> permissionManager =
+ do_CreateInstance (NS_PERMISSIONMANAGER_CONTRACTID);
+
+ for (GList *permissions = g_list_first(permissions); permissions != NULL;
+ permissions = g_list_next(permissions))
+ {
+ PermissionInfo *b = (PermissionInfo *)permissions->data;
+ result = permissionManager->Remove (nsDependentCString(b->domain),
+ type);
+ if (NS_FAILED(result)) return G_FAILED;
+ };
+
+ return G_OK;
+}
+
+static gresult
+impl_list_cookies (EphyEmbedShell *shell,
+ GList **cookies)
+{
+ nsresult result;
+
+ nsCOMPtr<nsICookieManager> cookieManager =
+ do_CreateInstance (NS_COOKIEMANAGER_CONTRACTID);
+ nsCOMPtr<nsISimpleEnumerator> cookieEnumerator;
+ result =
+ cookieManager->GetEnumerator (getter_AddRefs(cookieEnumerator));
+ if (NS_FAILED(result)) return G_FAILED;
+
+ PRBool enumResult;
+ for (cookieEnumerator->HasMoreElements(&enumResult) ;
+ enumResult == PR_TRUE ;
+ cookieEnumerator->HasMoreElements(&enumResult))
+ {
+ CookieInfo *c;
+
+ nsCOMPtr<nsICookie> nsCookie;
+ result = cookieEnumerator->GetNext (getter_AddRefs(nsCookie));
+ if (NS_FAILED(result)) return G_FAILED;
+
+ c = g_new0 (CookieInfo, 1);
+
+ nsCAutoString transfer;
+
+ nsCookie->GetHost (transfer);
+ c->base.domain = g_strdup (transfer.get());
+ nsCookie->GetName (transfer);
+ c->name = g_strdup (transfer.get());
+ nsCookie->GetValue (transfer);
+ c->value = g_strdup (transfer.get());
+ nsCookie->GetPath (transfer);
+ c->path = g_strdup (transfer.get());
+
+ PRBool isSecure;
+ nsCookie->GetIsSecure (&isSecure);
+ if (isSecure == PR_TRUE)
+ c->secure = g_strdup (_("Yes"));
+ else
+ c->secure = g_strdup (_("No"));
+
+ PRUint64 dateTime;
+ nsCookie->GetExpires (&dateTime);
+ if(dateTime == 0)
+ c->expire = g_strdup (_("End of current session"));
+ else
+ c->expire = g_strdup_printf ("%s",ctime((time_t*)&dateTime));
+
+ *cookies = g_list_prepend (*cookies, c);
+ }
+
+ *cookies = g_list_reverse (*cookies);
+
+ return G_OK;
+}
+
+static gresult
+impl_remove_cookies (EphyEmbedShell *shell,
+ GList *cookies)
+{
+ nsresult result;
+ GList *cl;
+ nsCOMPtr<nsICookieManager> cookieManager =
+ do_CreateInstance (NS_COOKIEMANAGER_CONTRACTID);
+
+ for (cl = g_list_first(cookies) ; cl != NULL ;
+ cl = g_list_next (cl))
+ {
+ CookieInfo *c = (CookieInfo *)cl->data;
+
+ result = cookieManager->Remove (NS_LITERAL_CSTRING(c->base.domain),
+ NS_LITERAL_CSTRING(c->name),
+ NS_LITERAL_CSTRING(c->path),
+ PR_FALSE);
+ if (NS_FAILED(result)) return G_FAILED;
+ };
+
+ return G_OK;
+}
+
+static gresult
+impl_list_passwords (EphyEmbedShell *shell,
+ PasswordType type,
+ GList **passwords)
+{
+ nsresult result = NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIPasswordManager> passwordManager =
+ do_CreateInstance (NS_PASSWORDMANAGER_CONTRACTID);
+ nsCOMPtr<nsISimpleEnumerator> passwordEnumerator;
+ if (type == PASSWORD_PASSWORD)
+ result = passwordManager->GetEnumerator
+ (getter_AddRefs(passwordEnumerator));
+ else if (type == PASSWORD_REJECT)
+ result = passwordManager->GetRejectEnumerator
+ (getter_AddRefs(passwordEnumerator));
+ if (NS_FAILED(result)) return G_FAILED;
+
+ PRBool enumResult;
+ for (passwordEnumerator->HasMoreElements(&enumResult) ;
+ enumResult == PR_TRUE ;
+ passwordEnumerator->HasMoreElements(&enumResult))
+ {
+ nsCOMPtr<nsIPassword> nsPassword;
+ result = passwordEnumerator->GetNext
+ (getter_AddRefs(nsPassword));
+ if (NS_FAILED(result)) return G_FAILED;
+
+ PasswordInfo *p = g_new0 (PasswordInfo, 1);
+
+ nsCAutoString transfer;
+ nsPassword->GetHost (transfer);
+ p->host = g_strdup (transfer.get());
+
+ if (type == PASSWORD_PASSWORD)
+ {
+ nsAutoString unicodeName;
+ nsPassword->GetUser (unicodeName);
+ p->username = g_strdup(NS_ConvertUCS2toUTF8(unicodeName).get());
+ }
+
+ *passwords = g_list_prepend (*passwords, p);
+ }
+
+ *passwords = g_list_reverse (*passwords);
+
+ return G_OK;
+}
+
+static gresult
+impl_remove_passwords (EphyEmbedShell *shell,
+ GList *passwords,
+ PasswordType type)
+{
+ nsresult result = NS_ERROR_FAILURE;
+ nsCOMPtr<nsIPasswordManager> passwordManager =
+ do_CreateInstance (NS_PASSWORDMANAGER_CONTRACTID);
+
+ for (GList *l = g_list_first(passwords) ; l !=NULL ;
+ l = g_list_next(l))
+ {
+ PasswordInfo *p = (PasswordInfo *)l->data;
+ if (type == PASSWORD_PASSWORD)
+ {
+ result = passwordManager->RemoveUser (NS_LITERAL_CSTRING(p->host),
+ NS_ConvertUTF8toUCS2(nsDependentCString(p->username)));
+ }
+ else if (type == PASSWORD_REJECT)
+ {
+ result = passwordManager->RemoveReject
+ (nsDependentCString(p->host));
+ };
+
+ if (NS_FAILED(result)) return G_FAILED;
+ };
+
+ return G_OK;
+}
+
+static gresult
+impl_show_file_picker (EphyEmbedShell *shell,
+ GtkWidget *parentWidget,
+ const char *title,
+ const char *directory,
+ const char *file,
+ FilePickerMode mode,
+ char **ret_fullpath,
+ gboolean *ret_save_content,
+ FileFormat *file_formats,
+ int *ret_file_format)
+{
+ PRBool showContentCheck;
+ gchar *expanded_directory;
+
+ if (ret_save_content == NULL)
+ showContentCheck = PR_FALSE;
+ else
+ showContentCheck = PR_TRUE;
+
+ GFilePicker *filePicker = new GFilePicker (showContentCheck,
+ file_formats);
+
+ /* FIXME sane path: expand tilde ... */
+ expanded_directory = g_strdup (directory);
+
+ /* make sure the directory exists, and use the home directory
+ * otherwise */
+ if (!expanded_directory ||
+ !g_file_test (expanded_directory, G_FILE_TEST_IS_DIR))
+ {
+ if (expanded_directory) g_free (expanded_directory);
+ expanded_directory = g_strdup (g_get_home_dir());
+ }
+
+ nsCOMPtr<nsILocalFile> dir =
+ do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ dir->InitWithPath (NS_ConvertUTF8toUCS2(expanded_directory));
+ g_free (expanded_directory);
+
+ filePicker->InitWithGtkWidget (parentWidget, title, mode);
+ filePicker->SetDefaultString (NS_ConvertUTF8toUCS2(file).get());
+ filePicker->SetDisplayDirectory (dir);
+
+ PRInt16 retval;
+ filePicker->Show (&retval);
+
+ if (ret_save_content != NULL)
+ {
+ if (retval == GFilePicker::returnOKSaveContent)
+ *ret_save_content = TRUE;
+ else
+ *ret_save_content = FALSE;
+ }
+ if (ret_file_format != NULL)
+ {
+ *ret_file_format = filePicker->mSelectedFileFormat;
+ }
+
+ if (retval == nsIFilePicker::returnCancel)
+ {
+ delete filePicker;
+ return G_FAILED;
+ }
+ else
+ {
+ if (*ret_fullpath)
+ g_free (*ret_fullpath);
+ nsCOMPtr<nsILocalFile> file;
+ filePicker->GetFile (getter_AddRefs(file));
+ nsAutoString tempFullPathStr;
+ file->GetPath (tempFullPathStr);
+ *ret_fullpath = g_strdup (NS_ConvertUCS2toUTF8(tempFullPathStr).get());
+ delete filePicker;
+ return G_OK;
+ }
+}
diff --git a/embed/mozilla/mozilla-embed-shell.h b/embed/mozilla/mozilla-embed-shell.h
new file mode 100644
index 000000000..daedb2948
--- /dev/null
+++ b/embed/mozilla/mozilla-embed-shell.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MOZILLA_EMBED_SHELL_H
+#define MOZILLA_EMBED_SHELL_H
+
+#include "glib.h"
+#include "ephy-embed-shell.h"
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MOZILLA_EMBED_SHELL_TYPE (mozilla_embed_shell_get_type ())
+#define MOZILLA_EMBED_SHELL(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_SHELL_TYPE, MozillaEmbedShell))
+#define MOZILLA_EMBED_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_SHELL_TYPE, MozillaEmbedShellClass))
+#define IS_MOZILLA_EMBED_SHELL(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_SHELL_TYPE))
+#define IS_MOZILLA_EMBED_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED_SHELL))
+#define MOZILLA_EMBED_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_SHELL_TYPE, MozillaEmbedShellClass))
+
+typedef struct MozillaEmbedShell MozillaEmbedShell;
+typedef struct MozillaEmbedShellPrivate MozillaEmbedShellPrivate;
+
+extern GObject *mozilla_js_console;
+
+struct MozillaEmbedShell
+{
+ EphyEmbedShell parent;
+ MozillaEmbedShellPrivate *priv;
+};
+
+struct MozillaEmbedShellClass
+{
+ EphyEmbedShellClass parent_class;
+};
+
+GType mozilla_embed_shell_get_type (void);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
new file mode 100644
index 000000000..d3d2277b0
--- /dev/null
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -0,0 +1,1585 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "gtkmozembed.h"
+#include "gtkmozembed_internal.h"
+#include "ephy-string.h"
+#include "ephy-embed.h"
+#include "mozilla-embed.h"
+#include "MozillaPrivate.h"
+#include "EphyWrapper.h"
+#include "EventContext.h"
+#include "nsIWindowWatcher.h"
+
+#include <nsIURI.h>
+#include <nsIURL.h>
+#include <nsNetUtil.h>
+#include <nsString.h>
+#include <nsIRequest.h>
+#include <nsIWebProgressListener.h>
+#include <nsITransportSecurityInfo.h>
+#include <nsIPrintOptions.h>
+#include <nsGfxCIID.h>
+
+#include <math.h>
+
+static void
+mozilla_embed_class_init (MozillaEmbedClass *klass);
+static void
+mozilla_embed_init (MozillaEmbed *gs);
+static void
+mozilla_embed_finalize (GObject *object);
+static void
+mozilla_embed_destroy (GtkObject *object);
+static void
+ephy_embed_init (EphyEmbedClass *embed_class);
+
+static void
+impl_get_capabilities (EphyEmbed *embed,
+ EmbedCapabilities *caps);
+static gresult
+impl_load_url (EphyEmbed *embed,
+ const char *url);
+static gresult
+impl_stop_load (EphyEmbed *embed);
+static gresult
+impl_can_go_back (EphyEmbed *embed);
+static gresult
+impl_can_go_forward (EphyEmbed *embed);
+static gresult
+impl_can_go_up (EphyEmbed *embed);
+static gresult
+impl_get_go_up_list (EphyEmbed *embed, GSList **l);
+static gresult
+impl_go_back (EphyEmbed *embed);
+static gresult
+impl_go_forward (EphyEmbed *embed);
+static gresult
+impl_go_up (EphyEmbed *embed);
+static gresult
+impl_render_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len,
+ const char *base_uri,
+ const char *mime_type);
+static gresult
+impl_open_stream (EphyEmbed *embed,
+ const char *base_uri,
+ const char *mime_type);
+static gresult
+impl_append_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len);
+static gresult
+impl_close_stream (EphyEmbed *embed);
+static gresult
+impl_get_title (EphyEmbed *embed,
+ char **title);
+static gresult
+impl_get_location (EphyEmbed *embed,
+ gboolean toplevel,
+ gboolean requested,
+ char **location);
+static gresult
+impl_reload (EphyEmbed *embed,
+ EmbedReloadFlags flags);
+static gresult
+impl_copy_page (EphyEmbed *dest,
+ EphyEmbed *source,
+ EmbedDisplayType display_type);
+static gresult
+impl_grab_focus (EphyEmbed *embed);
+static gresult
+impl_get_link_tags (EphyEmbed *embed,
+ const char *link_type,
+ GList **tags);
+static gresult
+impl_zoom_set (EphyEmbed *embed,
+ int zoom,
+ gboolean reflow);
+static gresult
+impl_zoom_get (EphyEmbed *embed,
+ int *zoom);
+static gresult
+impl_selection_can_cut (EphyEmbed *embed);
+static gresult
+impl_selection_can_copy (EphyEmbed *embed);
+static gresult
+impl_can_paste (EphyEmbed *embed);
+static gresult
+impl_select_all (EphyEmbed *embed);
+static gresult
+impl_selection_cut (EphyEmbed *embed);
+static gresult
+impl_selection_copy (EphyEmbed *embed);
+static gresult
+impl_paste (EphyEmbed *embed);
+static gresult
+impl_shistory_count (EphyEmbed *embed,
+ int *count);
+static gresult
+impl_shistory_get_nth (EphyEmbed *embed,
+ int nth,
+ gboolean is_relative,
+ char **url,
+ char **title);
+static gresult
+impl_shistory_get_pos (EphyEmbed *embed,
+ int *pos);
+static gresult
+impl_shistory_go_nth (EphyEmbed *embed,
+ int nth);
+static gboolean
+impl_shistory_copy (EphyEmbed *source,
+ EphyEmbed *dest);
+static gresult
+impl_scroll (EphyEmbed *embed,
+ EmbedScrollDirection direction);
+static gresult
+impl_fine_scroll (EphyEmbed *embed,
+ int horiz, int vert);
+static gresult
+impl_get_security_level (EphyEmbed *embed,
+ EmbedSecurityLevel *level,
+ char **description);
+static gresult
+impl_find (EphyEmbed *embed,
+ EmbedFindInfo *info);
+
+static gresult
+impl_set_charset (EphyEmbed *embed,
+ const char *charset);
+
+static gresult
+impl_print (EphyEmbed *embed,
+ EmbedPrintInfo *info);
+
+static gresult
+impl_print_preview_close (EphyEmbed *embed);
+
+static gresult
+impl_print_preview_num_pages (EphyEmbed *embed,
+ gint *retNum);
+static gresult
+impl_print_preview_navigate (EphyEmbed *embed,
+ EmbedPrintPreviewNavType navType,
+ gint pageNum);
+
+static void
+mozilla_embed_connect_signals (MozillaEmbed *membed);
+static char *
+mozilla_embed_get_uri_parent (const char *uri);
+static void
+mozilla_embed_location_changed_cb (GtkMozEmbed *embed, MozillaEmbed *membed);
+static void
+mozilla_embed_title_changed_cb (GtkMozEmbed *embed, MozillaEmbed *membed);
+static void
+mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, const char *aURI,
+ gint state, guint status, MozillaEmbed *membed);
+static void
+mozilla_embed_progress_cb (GtkMozEmbed *embed, const char *aURI,
+ gint curprogress, gint maxprogress, MozillaEmbed *membed);
+static void
+mozilla_embed_link_message_cb (GtkMozEmbed *embed, MozillaEmbed *membed);
+static void
+mozilla_embed_js_status_cb (GtkMozEmbed *embed, MozillaEmbed *membed);
+static void
+mozilla_embed_visibility_cb (GtkMozEmbed *embed, gboolean visibility, MozillaEmbed *membed);
+static void
+mozilla_embed_destroy_brsr_cb (GtkMozEmbed *embed, MozillaEmbed *embed);
+static gint
+mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event, MozillaEmbed *membed);
+static gint
+mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
+ MozillaEmbed *membed);
+static void
+mozilla_embed_size_to_cb (GtkMozEmbed *embed, gint width, gint height, MozillaEmbed *membed);
+static void
+mozilla_embed_new_window_cb (GtkMozEmbed *embed,
+ GtkMozEmbed **newEmbed,
+ guint chromemask, MozillaEmbed *membed);
+static void
+mozilla_embed_security_change_cb (GtkMozEmbed *embed,
+ gpointer request,
+ guint state, MozillaEmbed *membed);
+static EmbedSecurityLevel
+mozilla_embed_security_level (MozillaEmbed *membed);
+
+/* signals to connect on each embed widget */
+static const struct
+{
+ char *event;
+ void *func; /* should be a GtkSignalFunc or similar */
+}
+signal_connections[] =
+{
+ { "location", (void *) mozilla_embed_location_changed_cb },
+ { "title", (void *) mozilla_embed_title_changed_cb },
+ { "net_state_all", (void *) mozilla_embed_net_state_all_cb },
+ { "progress_all", (void *) mozilla_embed_progress_cb },
+ { "link_message", (void *) mozilla_embed_link_message_cb },
+ { "js_status", (void *) mozilla_embed_js_status_cb },
+ { "visibility", (void *) mozilla_embed_visibility_cb },
+ { "destroy_browser", (void *) mozilla_embed_destroy_brsr_cb },
+ { "dom_mouse_click", (void *) mozilla_embed_dom_mouse_click_cb },
+ { "dom_mouse_down", (void *) mozilla_embed_dom_mouse_down_cb },
+ { "size_to", (void *) mozilla_embed_size_to_cb },
+ { "new_window", (void *) mozilla_embed_new_window_cb },
+ { "security_change", (void *) mozilla_embed_security_change_cb },
+
+ /* terminator -- must be last in the list! */
+ { NULL, NULL }
+};
+
+struct MozillaEmbedPrivate
+{
+ MozillaEmbedPrivate() : wrapper(NULL), security_state(-1), no_page(1)
+ { /* nothing */ }
+
+ EphyWrapper *wrapper;
+ nsCOMPtr<nsIRequest> request;
+ gint security_state;
+
+ /* HACK 1: No page loaded, 0: Loading an empty page, -1: Page loaded */
+ gint no_page;
+};
+
+#define WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1"
+
+static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID);
+
+static GObjectClass *parent_class = NULL;
+
+GType
+mozilla_embed_get_type (void)
+{
+ static GType mozilla_embed_type = 0;
+
+ if (mozilla_embed_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (MozillaEmbedClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) mozilla_embed_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (MozillaEmbed),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mozilla_embed_init
+ };
+
+ static const GInterfaceInfo embed_info =
+ {
+ (GInterfaceInitFunc) ephy_embed_init, /* interface_init */
+ NULL, /* interface_finalize */
+ NULL /* interface_data */
+ };
+
+ mozilla_embed_type = g_type_register_static (GTK_TYPE_MOZ_EMBED,
+ "MozillaEmbed",
+ &our_info,
+ (GTypeFlags)0);
+ g_type_add_interface_static (mozilla_embed_type,
+ EPHY_EMBED_TYPE,
+ &embed_info);
+ }
+
+ return mozilla_embed_type;
+}
+
+static void
+ephy_embed_init (EphyEmbedClass *embed_class)
+{
+ embed_class->get_capabilities = impl_get_capabilities;
+ embed_class->load_url = impl_load_url;
+ embed_class->stop_load = impl_stop_load;
+ embed_class->can_go_back = impl_can_go_back;
+ embed_class->can_go_forward =impl_can_go_forward;
+ embed_class->can_go_up = impl_can_go_up;
+ embed_class->get_go_up_list = impl_get_go_up_list;
+ embed_class->go_back = impl_go_back;
+ embed_class->go_forward = impl_go_forward;
+ embed_class->go_up = impl_go_up;
+ embed_class->render_data = impl_render_data;
+ embed_class->open_stream = impl_open_stream;
+ embed_class->append_data = impl_append_data;
+ embed_class->close_stream = impl_close_stream;
+ embed_class->get_title = impl_get_title;
+ embed_class->get_location = impl_get_location;
+ embed_class->reload = impl_reload;
+ embed_class->copy_page = impl_copy_page;
+ embed_class->grab_focus = impl_grab_focus;
+ embed_class->get_link_tags = impl_get_link_tags;
+ embed_class->zoom_set = impl_zoom_set;
+ embed_class->zoom_get = impl_zoom_get;
+ embed_class->selection_can_cut = impl_selection_can_cut;
+ embed_class->selection_can_copy = impl_selection_can_copy;
+ embed_class->can_paste = impl_can_paste;
+ embed_class->selection_cut = impl_selection_cut;
+ embed_class->selection_copy = impl_selection_copy;
+ embed_class->paste = impl_paste;
+ embed_class->shistory_count = impl_shistory_count;
+ embed_class->shistory_get_nth = impl_shistory_get_nth;
+ embed_class->shistory_get_pos = impl_shistory_get_pos;
+ embed_class->shistory_go_nth = impl_shistory_go_nth;
+ embed_class->shistory_copy = impl_shistory_copy;
+ embed_class->scroll = impl_scroll;
+ embed_class->fine_scroll = impl_fine_scroll;
+ embed_class->get_security_level = impl_get_security_level;
+ embed_class->find = impl_find;
+ embed_class->set_charset = impl_set_charset;
+ embed_class->select_all = impl_select_all;
+ embed_class->print = impl_print;
+ embed_class->print_preview_close = impl_print_preview_close;
+ embed_class->print_preview_num_pages = impl_print_preview_num_pages;
+ embed_class->print_preview_navigate = impl_print_preview_navigate;
+}
+
+static void
+mozilla_embed_class_init (MozillaEmbedClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
+ parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
+
+ gtk_object_class->destroy = mozilla_embed_destroy;
+ object_class->finalize = mozilla_embed_finalize;
+}
+
+static void
+mozilla_embed_init (MozillaEmbed *embed)
+{
+ embed->priv = new MozillaEmbedPrivate;
+
+ mozilla_embed_connect_signals (embed);
+}
+
+gpointer
+mozilla_embed_get_galeon_wrapper (MozillaEmbed *embed)
+{
+ g_return_val_if_fail (embed->priv->wrapper != NULL, NULL);
+
+ return embed->priv->wrapper;
+}
+
+static void
+mozilla_embed_connect_signals (MozillaEmbed *embed)
+{
+ gint i;
+ EphyEmbed *gembed;
+
+ gembed = EPHY_EMBED (embed);
+
+ /* connect signals */
+ for (i = 0; signal_connections[i].event != NULL; i++)
+ {
+ g_signal_connect (G_OBJECT(embed),
+ signal_connections[i].event,
+ G_CALLBACK(signal_connections[i].func),
+ embed);
+ }
+}
+
+static void
+mozilla_embed_destroy (GtkObject *object)
+{
+ int i;
+
+ for (i = 0; signal_connections[i].event != NULL; i++)
+ {
+ g_signal_handlers_disconnect_by_func
+ (G_OBJECT(object),
+ (gpointer)signal_connections[i].func,
+ (void *)object);
+ }
+
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
+}
+
+static void
+mozilla_embed_finalize (GObject *object)
+{
+ MozillaEmbed *embed;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_MOZILLA_EMBED (object));
+
+ embed = MOZILLA_EMBED (object);
+
+ g_return_if_fail (embed->priv != NULL);
+
+ if (embed->priv->wrapper)
+ {
+ embed->priv->wrapper->Destroy();
+ delete embed->priv->wrapper;
+ embed->priv->wrapper = NULL;
+ }
+
+ delete embed->priv;
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+
+#ifdef DEBUG_MARCO
+ g_print ("MozillaEmbed finalized %p\n", embed);
+#endif
+}
+
+gpointer
+mozilla_embed_get_ephy_wrapper (MozillaEmbed *embed)
+{
+ g_return_val_if_fail (embed->priv->wrapper != NULL, NULL);
+
+ return embed->priv->wrapper;
+}
+
+static void
+impl_get_capabilities (EphyEmbed *embed,
+ EmbedCapabilities *caps)
+{
+ EmbedCapabilities mozilla_caps;
+
+ mozilla_caps = (EmbedCapabilities) (
+ EMBED_CLIPBOARD_CAP |
+ EMBED_COOKIES_CAP |
+ EMBED_LINKS_CAP |
+ EMBED_ZOOM_CAP |
+ EMBED_PRINT_CAP |
+ EMBED_FIND_CAP |
+ EMBED_SCROLL_CAP |
+ EMBED_FINE_SCROLL_CAP |
+ EMBED_SECURITY_CAP |
+ EMBED_CHARSET_CAP |
+ EMBED_SHISTORY_CAP );
+
+ *caps = mozilla_caps;
+}
+
+static gresult
+impl_load_url (EphyEmbed *embed,
+ const char *url)
+{
+ gtk_moz_embed_load_url (GTK_MOZ_EMBED(embed),
+ url);
+
+ return G_OK;
+}
+
+static gresult
+impl_stop_load (EphyEmbed *embed)
+{
+ gtk_moz_embed_stop_load (GTK_MOZ_EMBED(embed));
+
+ return G_OK;
+}
+
+static gresult
+impl_can_go_back (EphyEmbed *embed)
+{
+ if (gtk_moz_embed_can_go_back (GTK_MOZ_EMBED(embed)))
+ {
+ return G_OK;
+ }
+ else
+ {
+ return G_FAILED;
+ }
+}
+
+static gresult
+impl_can_go_forward (EphyEmbed *embed)
+{
+ if (gtk_moz_embed_can_go_forward (GTK_MOZ_EMBED(embed)))
+ {
+ return G_OK;
+ }
+ else
+ {
+ return G_FAILED;
+ }
+
+}
+
+static gresult
+impl_can_go_up (EphyEmbed *embed)
+{
+ char *location;
+ char *s;
+ gresult result;
+
+ if (ephy_embed_get_location (embed, TRUE, FALSE, &location) != G_OK)
+ return G_FAILED;
+ g_return_val_if_fail (location != NULL, G_FAILED);
+ if ((s = mozilla_embed_get_uri_parent (location)) != NULL)
+ {
+ g_free (s);
+ result = G_OK;
+ }
+ else
+ {
+ result = G_FAILED;
+ }
+
+ g_free (location);
+
+ return result;
+}
+
+static gresult
+impl_get_go_up_list (EphyEmbed *embed, GSList **l)
+{
+ char *location;
+ char *s;
+
+ if (ephy_embed_get_location (embed, TRUE, FALSE, &location) != G_OK)
+ return G_FAILED;
+ g_return_val_if_fail (location != NULL, G_FAILED);
+
+ *l = NULL;
+ s = location;
+ while ((s = mozilla_embed_get_uri_parent (s)) != NULL)
+ {
+ *l = g_slist_prepend (*l, s);
+ }
+
+ g_free (location);
+ *l = g_slist_reverse (*l);
+
+ return G_OK;
+}
+
+static gresult
+impl_go_back (EphyEmbed *embed)
+{
+ gtk_moz_embed_go_back (GTK_MOZ_EMBED(embed));
+
+ return G_OK;
+}
+
+static gresult
+impl_go_forward (EphyEmbed *embed)
+{
+ gtk_moz_embed_go_forward (GTK_MOZ_EMBED(embed));
+
+ return G_OK;
+}
+
+static gresult
+impl_go_up (EphyEmbed *embed)
+{
+ char *uri;
+ char *parent_uri;
+
+ ephy_embed_get_location (embed, TRUE, FALSE, &uri);
+ g_return_val_if_fail (uri != NULL, G_FAILED);
+
+ parent_uri = mozilla_embed_get_uri_parent (uri);
+ g_return_val_if_fail (parent_uri != NULL, G_FAILED);
+
+ ephy_embed_load_url (embed, parent_uri);
+
+ g_free (parent_uri);
+
+ return G_OK;
+}
+
+static char *
+mozilla_embed_get_uri_parent (const char *aUri)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIURI> uri;
+ rv = NS_NewURI (getter_AddRefs(uri), aUri);
+ if (NS_FAILED(rv) || !uri) return NULL;
+
+ nsCOMPtr<nsIURL> url = do_QueryInterface(uri, &rv);
+ if (NS_FAILED(rv) || !url) return NULL;
+
+ nsCAutoString dirPath;
+ rv = url->GetDirectory (dirPath);
+ if (NS_FAILED(rv) || !dirPath.Length()) return NULL;
+
+ nsCAutoString filePath;
+ rv = url->GetFilePath (filePath);
+ if (NS_FAILED(rv) || !filePath.Length()) return NULL;
+
+ PRInt32 pathLength = filePath.Length();
+ PRInt32 trailingSlash = filePath.RFind("/");
+
+ if(pathLength < 2 || trailingSlash == -1)
+ {
+ return NULL;
+ }
+
+ if(trailingSlash != (pathLength-1))
+ {
+ uri->SetPath(dirPath);
+ }
+ else
+ {
+ PRInt32 nextSlash = filePath.RFind("/",PR_FALSE,trailingSlash-1);
+ nsCAutoString parentPath;
+ filePath.Left(parentPath, nextSlash);
+ uri->SetPath(parentPath);
+ }
+
+ nsCAutoString spec;
+ uri->GetSpec(spec);
+
+ return !spec.IsEmpty() ? g_strdup(spec.get()) : NULL;
+}
+
+static gresult
+impl_render_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len,
+ const char *base_uri,
+ const char *mime_type)
+{
+ gtk_moz_embed_render_data (GTK_MOZ_EMBED(embed),
+ data,
+ len,
+ base_uri,
+ mime_type);
+
+ return G_OK;
+}
+
+static gresult
+impl_open_stream (EphyEmbed *embed,
+ const char *base_uri,
+ const char *mime_type)
+{
+ gtk_moz_embed_open_stream (GTK_MOZ_EMBED(embed),
+ base_uri, mime_type);
+
+ return G_OK;
+}
+
+static gresult
+impl_append_data (EphyEmbed *embed,
+ const char *data,
+ guint32 len)
+{
+ gtk_moz_embed_append_data (GTK_MOZ_EMBED(embed),
+ data, len);
+
+ return G_OK;
+}
+
+static gresult
+impl_close_stream (EphyEmbed *embed)
+{
+ gtk_moz_embed_close_stream (GTK_MOZ_EMBED(embed));
+
+ return G_OK;
+}
+
+static gresult
+impl_get_title (EphyEmbed *embed,
+ char **title)
+{
+ nsXPIDLString uTitle;
+
+ *getter_Copies(uTitle) =
+ gtk_moz_embed_get_title_unichar (GTK_MOZ_EMBED(embed));
+
+ *title = g_strdup (NS_ConvertUCS2toUTF8(uTitle).get());
+
+ return G_OK;
+}
+
+static gresult
+impl_get_location (EphyEmbed *embed,
+ gboolean toplevel,
+ gboolean requested,
+ char **location)
+{
+ char *l;
+ nsresult rv;
+ nsCAutoString url;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+
+ /* if the wrapper is NULL than we have no location,
+ * in fact the wrapper is initialized on net start */
+ if (!wrapper)
+ {
+ *location = NULL;
+ return G_FAILED;
+ }
+
+ /* FIXME !toplevel requested not implemented */
+
+ if (toplevel)
+ {
+ l = gtk_moz_embed_get_location
+ (GTK_MOZ_EMBED(embed));
+ }
+ else if (!toplevel)
+ {
+ rv = wrapper->GetDocumentUrl (url);
+ l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ?
+ g_strdup (url.get()) : NULL;
+ }
+ else if (requested)
+ {
+ rv = wrapper->GetRealURL (url);
+ l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ?
+ g_strdup (url.get()) : NULL;
+ }
+
+ *location = l;
+
+ return G_OK;
+}
+
+static gresult
+impl_reload (EphyEmbed *embed,
+ EmbedReloadFlags flags)
+{
+ guint32 mflags;
+
+ mflags = GTK_MOZ_EMBED_FLAG_RELOADNORMAL;
+
+ if ((flags & EMBED_RELOAD_BYPASSCACHE) &&
+ (flags & EMBED_RELOAD_BYPASSPROXY))
+ {
+ mflags = GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE;
+ }
+ else if (flags & EMBED_RELOAD_BYPASSCACHE)
+ {
+ mflags = GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE;
+ }
+ else if (flags & EMBED_RELOAD_BYPASSPROXY)
+ {
+ mflags = GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY;
+ }
+
+ gtk_moz_embed_reload (GTK_MOZ_EMBED(embed),
+ mflags);
+
+ return G_OK;
+}
+
+static gresult
+impl_copy_page (EphyEmbed *dest,
+ EphyEmbed *source,
+ EmbedDisplayType display_type)
+{
+ EphyWrapper *dWrapper;
+ dWrapper = MOZILLA_EMBED(dest)->priv->wrapper;
+ g_return_val_if_fail (dWrapper != NULL, G_FAILED);
+
+ EphyWrapper *sWrapper;
+ sWrapper = MOZILLA_EMBED(source)->priv->wrapper;
+ g_return_val_if_fail (sWrapper != NULL, G_FAILED);
+
+ nsresult rv;
+
+ nsCOMPtr<nsISupports> pageDescriptor;
+ rv = sWrapper->GetPageDescriptor(getter_AddRefs(pageDescriptor));
+ if (!pageDescriptor || NS_FAILED(rv)) return G_FAILED;
+
+ rv = dWrapper->LoadDocument(pageDescriptor, static_cast<PRUint32>(display_type));
+ if (NS_FAILED(rv)) return G_FAILED;
+
+ return G_OK;
+}
+
+static gresult
+impl_grab_focus (EphyEmbed *embed)
+{
+ gtk_widget_grab_focus (GTK_BIN (embed)->child);
+
+ return G_OK;
+}
+
+static gresult
+impl_get_link_tags (EphyEmbed *embed,
+ const char *link_type,
+ GList **tags)
+{
+ return G_NOT_IMPLEMENTED;
+}
+
+static gresult
+impl_zoom_set (EphyEmbed *embed,
+ int zoom,
+ gboolean reflow)
+{
+ EphyWrapper *wrapper;
+ nsresult result;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ result = wrapper->SetZoom ((float)(zoom) / 100, reflow);
+
+ if (NS_SUCCEEDED (result))
+ {
+ g_signal_emit_by_name (embed, "ge_zoom_change", zoom);
+ }
+
+ return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_zoom_get (EphyEmbed *embed,
+ int *zoom)
+{
+ float f;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ if (!wrapper)
+ {
+ *zoom = 100;
+ return G_OK;
+ }
+
+ nsresult result = wrapper->GetZoom (&f);
+
+ if (NS_SUCCEEDED (result))
+ {
+ *zoom = (int) rint (f * 100);
+
+ return G_OK;
+ }
+ else
+ {
+ return G_FAILED;
+ }
+}
+
+static gresult
+impl_selection_can_cut (EphyEmbed *embed)
+{
+ gboolean result;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ wrapper->CanCutSelection (&result);
+
+ return result ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_selection_can_copy (EphyEmbed *embed)
+{
+ gboolean result;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ wrapper->CanCopySelection (&result);
+
+ return result ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_can_paste (EphyEmbed *embed)
+{
+ gboolean result;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ wrapper->CanPaste (&result);
+
+ return result ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_select_all (EphyEmbed *embed)
+{
+ nsresult result;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ result = wrapper->SelectAll ();
+
+ return result ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_selection_cut (EphyEmbed *embed)
+{
+ nsresult rv;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ rv = wrapper->CutSelection ();
+
+ return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_selection_copy (EphyEmbed *embed)
+{
+ nsresult rv;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ rv = wrapper->CopySelection ();
+
+ return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_paste (EphyEmbed *embed)
+{
+ nsresult rv;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ rv = wrapper->Paste ();
+
+ return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_shistory_count (EphyEmbed *embed,
+ int *count)
+{
+ nsresult rv;
+ EphyWrapper *wrapper;
+ int c, index;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ rv = wrapper->GetSHInfo (&c, &index);
+
+ *count = c;
+
+ return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_shistory_get_nth (EphyEmbed *embed,
+ int nth,
+ gboolean is_relative,
+ char **aUrl,
+ char **aTitle)
+{
+ nsresult rv;
+ nsCAutoString url;
+ PRUnichar *title;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ if (is_relative)
+ {
+ int pos;
+
+ if (ephy_embed_shistory_get_pos
+ (EPHY_EMBED(embed), &pos) == G_OK)
+ {
+ pos += nth;
+ }
+ else
+ {
+ return G_FAILED;
+ }
+ }
+
+ rv = wrapper->GetSHUrlAtIndex(nth, url);
+
+ *aUrl = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ? g_strdup(url.get()) : NULL;
+
+ rv = wrapper->GetSHTitleAtIndex(nth, &title);
+
+ *aTitle = g_strdup (NS_ConvertUCS2toUTF8(title).get());
+
+ return G_OK;
+}
+
+static gresult
+impl_shistory_get_pos (EphyEmbed *embed,
+ int *pos)
+{
+ nsresult rv;
+ EphyWrapper *wrapper;
+ int count, index;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ rv = wrapper->GetSHInfo (&count, &index);
+
+ *pos = index;
+
+ return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_shistory_go_nth (EphyEmbed *embed,
+ int nth)
+{
+ nsresult rv;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ rv = wrapper->GoToHistoryIndex (nth);
+
+ return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
+}
+
+static gboolean
+impl_shistory_copy (EphyEmbed *source,
+ EphyEmbed *dest)
+{
+ nsresult rv;
+ EphyWrapper *s_wrapper;
+ EphyWrapper *d_wrapper;
+
+ s_wrapper = MOZILLA_EMBED(source)->priv->wrapper;
+ g_return_val_if_fail (s_wrapper != NULL, G_FAILED);
+
+ d_wrapper = MOZILLA_EMBED(dest)->priv->wrapper;
+ g_return_val_if_fail (d_wrapper != NULL, G_FAILED);
+
+ rv = s_wrapper->CopyHistoryTo (d_wrapper);
+
+ return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_scroll (EphyEmbed *embed,
+ EmbedScrollDirection direction)
+{
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ switch (direction)
+ {
+ case EMBED_SCROLL_UP:
+ wrapper->ScrollUp ();
+ break;
+ case EMBED_SCROLL_DOWN:
+ wrapper->ScrollDown ();
+ break;
+ case EMBED_SCROLL_LEFT:
+ wrapper->ScrollLeft ();
+ break;
+ case EMBED_SCROLL_RIGHT:
+ wrapper->ScrollRight ();
+ break;
+ }
+
+ return G_OK;
+}
+
+static gresult
+impl_fine_scroll (EphyEmbed *embed, int horiz, int vert)
+{
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ wrapper->FineScroll (horiz, vert);
+
+ return G_OK;
+}
+
+static gresult
+impl_get_security_level (EphyEmbed *embed,
+ EmbedSecurityLevel *level,
+ char **description)
+{
+ nsresult result;
+
+ nsCOMPtr<nsIChannel> channel;
+ channel = do_QueryInterface (MOZILLA_EMBED(embed)->priv->request,
+ &result);
+ if (NS_FAILED (result)) return G_FAILED;
+
+ nsCOMPtr<nsISupports> info;
+ result = channel->GetSecurityInfo(getter_AddRefs(info));
+ if (NS_FAILED (result)) return G_FAILED;
+
+ *description = NULL;
+ if (info)
+ {
+ nsCOMPtr<nsITransportSecurityInfo> secInfo(do_QueryInterface(info));
+ if (!secInfo) return G_FAILED;
+
+ nsXPIDLString tooltip;
+ result = secInfo->GetShortSecurityDescription(getter_Copies(tooltip));
+ if (NS_FAILED (result)) return G_FAILED;
+
+ if (tooltip)
+ {
+ const nsString &string = nsString(tooltip);
+ char *tmp;
+ tmp = ToNewCString (string);
+
+ *description = g_strdup (tmp);
+
+ nsMemory::Free (tmp);
+ }
+ }
+
+ *level = mozilla_embed_security_level (MOZILLA_EMBED (embed));
+ return G_OK;
+}
+
+static gresult
+impl_print (EphyEmbed *embed,
+ EmbedPrintInfo *info)
+{
+ nsresult result = NS_OK;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ nsCOMPtr<nsIPrintSettings> options;
+ result = wrapper->GetPrintSettings(getter_AddRefs(options));
+ g_assert (NS_SUCCEEDED (result));
+
+ MozillaCollatePrintSettings(info, options);
+
+ options->SetPrintSilent (PR_TRUE);
+
+ result = wrapper->Print(options, info->preview);
+
+ return NS_SUCCEEDED (result) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_print_preview_close (EphyEmbed *embed)
+{
+ nsresult result = NS_OK;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ result = wrapper->PrintPreviewClose();
+ return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_print_preview_num_pages (EphyEmbed *embed,
+ gint *retNum)
+{
+ nsresult result = NS_OK;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ result = wrapper->PrintPreviewNumPages(retNum);
+ return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_print_preview_navigate (EphyEmbed *embed,
+ EmbedPrintPreviewNavType navType,
+ gint pageNum)
+{
+ nsresult result = NS_OK;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ result = wrapper->PrintPreviewNavigate(navType, pageNum);
+ return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_find (EphyEmbed *embed,
+ EmbedFindInfo *info)
+{
+ nsresult result = NS_OK;
+ EphyWrapper *wrapper;
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ PRBool didFind;
+
+ result = wrapper->Find ((NS_ConvertUTF8toUCS2(info->search_string)).get(),
+ info->interactive,
+ info->match_case,
+ info->backwards, info->wrap,
+ info->entire_word, info->search_frames,
+ &didFind);
+
+ return didFind ? G_OK : G_FAILED;
+}
+
+static gresult
+impl_set_charset (EphyEmbed *embed,
+ const char *charset)
+{
+ nsresult result = NS_OK;
+ EphyWrapper *wrapper;
+ char *cset;
+
+ cset = g_strdup (charset);
+
+ wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ wrapper->ForceCharacterSet (cset);
+
+ g_free (cset);
+
+ return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
+}
+
+static void
+mozilla_embed_location_changed_cb (GtkMozEmbed *embed,
+ MozillaEmbed *membed)
+{
+ /* Do not emit signal if we are loading the
+ * fallback about:blank. We dont want the user
+ * to know about it. */
+ if (membed->priv->no_page != 0)
+ {
+ g_signal_emit_by_name (membed, "ge_location");
+ }
+
+ membed->priv->no_page = -1;
+}
+
+static void
+mozilla_embed_title_changed_cb (GtkMozEmbed *embed,
+ MozillaEmbed *membed)
+{
+ g_return_if_fail (IS_MOZILLA_EMBED (membed));
+ g_return_if_fail (GTK_IS_WIDGET (embed));
+ g_signal_emit_by_name (membed, "ge_title");
+}
+
+static void
+mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, const char *aURI,
+ gint state, guint status,
+ MozillaEmbed *membed)
+{
+ EmbedState estate = EMBED_STATE_UNKNOWN;
+ int i;
+
+ struct
+ {
+ guint state;
+ EmbedState embed_state;
+ }
+ conversion_map [] =
+ {
+ { GTK_MOZ_EMBED_FLAG_START, EMBED_STATE_START },
+ { GTK_MOZ_EMBED_FLAG_STOP, EMBED_STATE_STOP },
+ { GTK_MOZ_EMBED_FLAG_REDIRECTING, EMBED_STATE_REDIRECTING },
+ { GTK_MOZ_EMBED_FLAG_TRANSFERRING, EMBED_STATE_TRANSFERRING },
+ { GTK_MOZ_EMBED_FLAG_NEGOTIATING, EMBED_STATE_NEGOTIATING },
+ { GTK_MOZ_EMBED_FLAG_IS_REQUEST, EMBED_STATE_IS_REQUEST },
+ { GTK_MOZ_EMBED_FLAG_IS_DOCUMENT, EMBED_STATE_IS_DOCUMENT },
+ { GTK_MOZ_EMBED_FLAG_IS_NETWORK, EMBED_STATE_IS_NETWORK },
+ { 0, EMBED_STATE_UNKNOWN }
+ };
+
+ /* No page loaded, default to about:blank */
+ if (membed->priv->no_page > 0 &&
+ (state & GTK_MOZ_EMBED_FLAG_STOP) &&
+ (state & GTK_MOZ_EMBED_FLAG_IS_DOCUMENT))
+ {
+ ephy_embed_load_url (EPHY_EMBED(membed), "about:blank");
+ membed->priv->no_page = 0;
+ }
+
+ if (!membed->priv->wrapper)
+ {
+ membed->priv->wrapper = new EphyWrapper ();
+
+ nsresult result;
+ result = membed->priv->wrapper->Init (GTK_MOZ_EMBED(embed));
+ if (NS_FAILED(result))
+ {
+ g_warning ("Wrapper initialization failed");
+ }
+ }
+
+ for (i = 0; conversion_map[i].state != 0; i++)
+ {
+ if (state & conversion_map[i].state)
+ {
+ estate = (EmbedState) (estate | conversion_map[i].embed_state);
+ }
+ }
+
+ g_signal_emit_by_name (membed, "ge_net_state", aURI, estate);
+}
+
+static void
+mozilla_embed_progress_cb (GtkMozEmbed *embed, const char *aURI,
+ gint curprogress, gint maxprogress,
+ MozillaEmbed *membed)
+{
+ g_signal_emit_by_name (membed, "ge_progress", aURI,
+ curprogress, maxprogress);
+}
+
+static void
+mozilla_embed_link_message_cb (GtkMozEmbed *embed,
+ MozillaEmbed *membed)
+{
+ nsXPIDLString message;
+
+ *getter_Copies(message) = gtk_moz_embed_get_link_message_unichar (embed);
+
+ g_signal_emit_by_name (membed, "ge_link_message",
+ g_strdup(NS_ConvertUCS2toUTF8(message).get()));
+}
+
+static void
+mozilla_embed_js_status_cb (GtkMozEmbed *embed,
+ MozillaEmbed *membed)
+{
+ nsXPIDLString status;
+
+ *getter_Copies(status) = gtk_moz_embed_get_js_status_unichar (embed);
+
+ g_signal_emit_by_name (membed, "ge_js_status",
+ g_strdup(NS_ConvertUCS2toUTF8(status).get()));
+}
+
+static void
+mozilla_embed_visibility_cb (GtkMozEmbed *embed, gboolean visibility,
+ MozillaEmbed *membed)
+{
+ g_signal_emit_by_name (membed, "ge_visibility", visibility);
+
+ nsresult rv;
+ nsCOMPtr<nsIWindowWatcher> wwatch
+ (do_GetService(WINDOWWATCHER_CONTRACTID, &rv));
+ if (NS_FAILED(rv) || !wwatch) return;
+
+ EphyWrapper *wrapper = (EphyWrapper *)mozilla_embed_get_galeon_wrapper(membed);
+ if(!wrapper) return;
+
+ nsCOMPtr<nsIDOMWindow> domWindow;
+ rv = wrapper->GetDOMWindow(getter_AddRefs(domWindow));
+ if(NS_FAILED(rv) || !domWindow) return;
+
+ rv = wwatch->SetActiveWindow(domWindow);
+}
+
+static void
+mozilla_embed_destroy_brsr_cb (GtkMozEmbed *embed,
+ MozillaEmbed *membed)
+{
+ g_signal_emit_by_name (membed, "ge_destroy_brsr");
+}
+
+static gint
+mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event,
+ MozillaEmbed *membed)
+{
+ EphyEmbedEvent *info;
+ EventContext event_context;
+ gint return_value = 0;
+ EphyWrapper *wrapper;
+ nsresult result;
+
+ info = ephy_embed_event_new ();
+
+ wrapper = MOZILLA_EMBED(membed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ event_context.Init ((nsIDOMEvent*)dom_event, wrapper);
+ result = event_context.GetMouseEventInfo (info);
+
+ nsCOMPtr<nsIDOMDocument> domDoc;
+ result = event_context.GetTargetDocument (getter_AddRefs(domDoc));
+ if (NS_SUCCEEDED(result))
+ {
+ result = wrapper->PushTargetDocument (domDoc);
+ }
+
+ g_signal_emit_by_name (membed, "ge_dom_mouse_click", info, &return_value);
+
+ wrapper->PopTargetDocument ();
+
+ g_object_unref (info);
+
+ return return_value;
+}
+
+static gint
+mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
+ MozillaEmbed *membed)
+{
+ EphyEmbedEvent *info;
+ EventContext event_context;
+ gint return_value = 0;
+ EphyWrapper *wrapper;
+ nsresult result;
+
+ info = ephy_embed_event_new ();
+
+ wrapper = MOZILLA_EMBED(membed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ event_context.Init ((nsIDOMEvent*)dom_event, wrapper);
+ result = event_context.GetMouseEventInfo (info);
+ if (NS_SUCCEEDED(result))
+ {
+ nsCOMPtr<nsIDOMDocument> domDoc;
+ result = event_context.GetTargetDocument (getter_AddRefs(domDoc));
+ if (NS_SUCCEEDED(result))
+ {
+ result = wrapper->PushTargetDocument (domDoc);
+ if (NS_SUCCEEDED(result))
+ {
+ g_signal_emit_by_name (membed, "ge_dom_mouse_down",
+ info, &return_value);
+ wrapper->PopTargetDocument ();
+ }
+ }
+
+ }
+
+ g_object_unref (info);
+
+ return return_value;
+}
+
+static void
+mozilla_embed_size_to_cb (GtkMozEmbed *embed, gint width, gint height,
+ MozillaEmbed *membed)
+{
+ g_signal_emit_by_name (membed, "ge_size_to", width, height);
+}
+
+static void
+mozilla_embed_new_window_cb (GtkMozEmbed *embed,
+ GtkMozEmbed **newEmbed,
+ guint chromemask,
+ MozillaEmbed *membed)
+{
+ int i;
+ EmbedChromeMask mask = EMBED_CHROME_OPENASPOPUP;
+ EphyEmbed *new_embed = NULL;
+
+ struct
+ {
+ guint chromemask;
+ EmbedChromeMask embed_mask;
+ }
+ conversion_map [] =
+ {
+ { GTK_MOZ_EMBED_FLAG_DEFAULTCHROME, EMBED_CHROME_DEFAULT },
+ { GTK_MOZ_EMBED_FLAG_MENUBARON, EMBED_CHROME_MENUBARON },
+ { GTK_MOZ_EMBED_FLAG_TOOLBARON, EMBED_CHROME_TOOLBARON },
+ { GTK_MOZ_EMBED_FLAG_PERSONALTOOLBARON, EMBED_CHROME_PERSONALTOOLBARON },
+ { GTK_MOZ_EMBED_FLAG_STATUSBARON, EMBED_CHROME_STATUSBARON },
+ { GTK_MOZ_EMBED_FLAG_WINDOWRAISED, EMBED_CHROME_WINDOWRAISED },
+ { GTK_MOZ_EMBED_FLAG_WINDOWLOWERED, EMBED_CHROME_WINDOWLOWERED },
+ { GTK_MOZ_EMBED_FLAG_CENTERSCREEN, EMBED_CHROME_CENTERSCREEN },
+ { GTK_MOZ_EMBED_FLAG_OPENASDIALOG, EMBED_CHROME_OPENASDIALOG },
+ { GTK_MOZ_EMBED_FLAG_OPENASCHROME, EMBED_CHROME_OPENASCHROME },
+ { 0, EMBED_CHROME_NONE }
+ };
+
+ for (i = 0; conversion_map[i].chromemask != 0; i++)
+ {
+ if (chromemask & conversion_map[i].chromemask)
+ {
+ mask = (EmbedChromeMask) (mask | conversion_map[i].embed_mask);
+ }
+ }
+
+ g_signal_emit_by_name (membed, "ge_new_window", &new_embed, mask);
+
+ g_assert (new_embed != NULL);
+
+ *newEmbed = GTK_MOZ_EMBED(new_embed);
+}
+
+static void
+mozilla_embed_security_change_cb (GtkMozEmbed *embed,
+ gpointer request,
+ guint state,
+ MozillaEmbed *membed)
+{
+ EmbedSecurityLevel level;
+
+ membed->priv->request = (nsIRequest *) request;
+ membed->priv->security_state = state;
+ level = mozilla_embed_security_level (membed);
+
+ g_signal_emit_by_name (membed, "ge_security_change", level);
+}
+
+static EmbedSecurityLevel
+mozilla_embed_security_level (MozillaEmbed *membed)
+{
+ EmbedSecurityLevel level;
+
+ switch (membed->priv->security_state)
+ {
+ case nsIWebProgressListener::STATE_IS_INSECURE:
+ level = STATE_IS_INSECURE;
+ break;
+ case nsIWebProgressListener::STATE_IS_BROKEN:
+ level = STATE_IS_BROKEN;
+ break;
+ case nsIWebProgressListener::STATE_IS_SECURE|
+ nsIWebProgressListener::STATE_SECURE_HIGH:
+ level = STATE_IS_SECURE_HIGH;
+ break;
+ case nsIWebProgressListener::STATE_IS_SECURE|
+ nsIWebProgressListener::STATE_SECURE_MED:
+ level = STATE_IS_SECURE_MED;
+ break;
+ case nsIWebProgressListener::STATE_IS_SECURE|
+ nsIWebProgressListener::STATE_SECURE_LOW:
+ level = STATE_IS_SECURE_LOW;
+ break;
+ default:
+ level = STATE_IS_UNKNOWN;
+ break;
+ }
+ return level;
+}
+
diff --git a/embed/mozilla/mozilla-embed.h b/embed/mozilla/mozilla-embed.h
new file mode 100644
index 000000000..b8ebca4c8
--- /dev/null
+++ b/embed/mozilla/mozilla-embed.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MOZILLA_EMBED_H
+#define MOZILLA_EMBED_H
+
+#include "ephy-embed-types.h"
+#include "ephy-embed.h"
+
+#include <gtkmozembed.h>
+
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct MozillaEmbedClass MozillaEmbedClass;
+
+#define MOZILLA_EMBED_TYPE (mozilla_embed_get_type ())
+#define MOZILLA_EMBED(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_TYPE, MozillaEmbed))
+#define MOZILLA_EMBED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_TYPE, MozillaEmbedClass))
+#define IS_MOZILLA_EMBED(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_TYPE))
+#define IS_MOZILLA_EMBED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED))
+#define MOZILLA_EMBED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_TYPE, MozillaEmbedClass))
+
+typedef struct MozillaEmbed MozillaEmbed;
+typedef struct MozillaEmbedPrivate MozillaEmbedPrivate;
+
+struct MozillaEmbed
+{
+ GtkMozEmbed parent;
+ MozillaEmbedPrivate *priv;
+};
+
+struct MozillaEmbedClass
+{
+ GtkMozEmbedClass parent_class;
+};
+
+GType mozilla_embed_get_type (void);
+
+gpointer mozilla_embed_get_galeon_wrapper (MozillaEmbed *embed);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/mozilla/mozilla-i18n.c b/embed/mozilla/mozilla-i18n.c
new file mode 100644
index 000000000..c974d9765
--- /dev/null
+++ b/embed/mozilla/mozilla-i18n.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "mozilla-i18n.h"
+
+#include <libgnome/gnome-i18n.h>
+
+const char *lgroups[] = {
+ N_("Arabic"),
+ N_("Baltic"),
+ N_("Central European"),
+ N_("Chinese"),
+ N_("Cyrillic"),
+ N_("Greek"),
+ N_("Hebrew"),
+ N_("Indian"),
+ N_("Japanese"),
+ N_("Korean"),
+ N_("Turkish"),
+ N_("Unicode"),
+ N_("Vietnamese"),
+ N_("Western"),
+ N_("Other"),
+ NULL
+};
+
+const CharsetInfoPriv charset_trans_array[] = {
+ {N_("Arabic (IBM-864)"), "IBM864", LG_ARABIC},
+ {N_("Arabic (IBM-864-I)"), "IBM864i", LG_ARABIC},
+ {N_("Arabic (ISO-8859-6)"), "ISO-8859-6", LG_ARABIC},
+ {N_("Arabic (ISO-8859-6-E)"), "ISO-8859-6-E", LG_ARABIC},
+ {N_("Arabic (ISO-8859-6-I)"), "ISO-8859-6-I", LG_ARABIC},
+ {N_("Arabic (MacArabic)"), "x-mac-arabic", LG_ARABIC},
+ {N_("Arabic (Windows-1256)"), "windows-1256", LG_ARABIC},
+ {N_("Armenian (ARMSCII-8)"), "armscii-8", LG_OTHER},
+ {N_("Baltic (ISO-8859-13)"), "ISO-8859-13", LG_BALTIC},
+ {N_("Baltic (ISO-8859-4)"), "ISO-8859-4", LG_BALTIC},
+ {N_("Baltic (Windows-1257)"), "windows-1257", LG_BALTIC},
+ {N_("Celtic (ISO-8859-14)"), "ISO-8859-14", LG_OTHER},
+ {N_("Central European (IBM-852)"), "IBM852", LG_CENTRAL_EUROPEAN},
+ {N_("Central European (ISO-8859-2)"), "ISO-8859-2", LG_CENTRAL_EUROPEAN},
+ {N_("Central European (MacCE)"), "x-mac-ce", LG_CENTRAL_EUROPEAN},
+ {N_("Central European (Windows-1250)"), "windows-1250", LG_CENTRAL_EUROPEAN},
+ {N_("Chinese Simplified (GB18030)"), "gb18030", LG_CHINESE},
+ {N_("Chinese Simplified (GB2312)"), "GB2312", LG_CHINESE},
+ {N_("Chinese Simplified (GBK)"), "x-gbk", LG_CHINESE},
+ {N_("Chinese Simplified (HZ)"), "HZ-GB-2312", LG_CHINESE},
+ {N_("Chinese Simplified (Windows-936)"), "windows-936", LG_CHINESE},
+ {N_("Chinese Traditional (Big5)"), "Big5", LG_CHINESE},
+ {N_("Chinese Traditional (Big5-HKSCS)"), "Big5-HKSCS", LG_CHINESE},
+ {N_("Chinese Traditional (EUC-TW)"), "x-euc-tw", LG_CHINESE},
+ {N_("Croatian (MacCroatian)"), "x-mac-croatian", LG_CENTRAL_EUROPEAN},
+ {N_("Cyrillic (IBM-855)"), "IBM855", LG_CYRILLIC},
+ {N_("Cyrillic (ISO-8859-5)"), "ISO-8859-5", LG_CYRILLIC},
+ {N_("Cyrillic (ISO-IR-111)"), "ISO-IR-111", LG_CYRILLIC},
+ {N_("Cyrillic (KOI8-R)"), "KOI8-R", LG_CYRILLIC},
+ {N_("Cyrillic (MacCyrillic)"), "x-mac-cyrillic", LG_CYRILLIC},
+ {N_("Cyrillic (Windows-1251)"), "windows-1251", LG_CYRILLIC},
+ {N_("Cyrillic/Russian (CP-866)"), "IBM866", LG_CYRILLIC},
+ {N_("Cyrillic/Ukrainian (KOI8-U)"), "KOI8-U", LG_CYRILLIC},
+ {N_("Cyrillic/Ukrainian (MacUkrainian)"), "x-mac-ukrainian", LG_CYRILLIC},
+ {N_("English (US-ASCII)"), "us-ascii", LG_WESTERN},
+ {N_("Farsi (MacFarsi)"), "x-mac-farsi", LG_OTHER},
+ {N_("Georgian (GEOSTD8)"), "geostd8", LG_OTHER},
+ {N_("Greek (ISO-8859-7)"), "ISO-8859-7", LG_GREEK},
+ {N_("Greek (MacGreek)"), "x-mac-greek", LG_GREEK},
+ {N_("Greek (Windows-1253)"), "windows-1253", LG_GREEK},
+ {N_("Gujarati (MacGujarati)"), "x-mac-gujarati", LG_INDIAN},
+ {N_("Gurmukhi (MacGurmukhi)"), "x-mac-gurmukhi", LG_INDIAN},
+ {N_("Hebrew (IBM-862)"), "IBM862", LG_HEBREW},
+ {N_("Hebrew (ISO-8859-8-E)"), "ISO-8859-8-E", LG_HEBREW},
+ {N_("Hebrew (ISO-8859-8-I)"), "ISO-8859-8-I", LG_HEBREW},
+ {N_("Hebrew (MacHebrew)"), "x-mac-hebrew", LG_HEBREW},
+ {N_("Hebrew (Windows-1255)"), "windows-1255", LG_HEBREW},
+ {N_("Hindi (MacDevanagari)"), "x-mac-devanagari", LG_INDIAN},
+ {N_("Icelandic (MacIcelandic)"), "x-mac-icelandic", LG_OTHER},
+ {N_("Japanese (EUC-JP)"), "EUC-JP", LG_JAPANESE},
+ {N_("Japanese (ISO-2022-JP)"), "ISO-2022-JP", LG_JAPANESE},
+ {N_("Japanese (Shift_JIS)"), "Shift_JIS", LG_JAPANESE},
+ {N_("Korean (EUC-KR)"), "EUC-KR", LG_KOREAN},
+ {N_("Korean (ISO-2022-KR)"), "ISO-2022-KR", LG_KOREAN},
+ {N_("Korean (JOHAB)"), "x-johab", LG_KOREAN},
+ {N_("Korean (UHC)"), "x-windows-949", LG_KOREAN},
+ {N_("Nordic (ISO-8859-10)"), "ISO-8859-10", LG_OTHER},
+ {N_("Romanian (MacRomanian)"), "x-mac-romanian", LG_OTHER},
+ {N_("Romanian (ISO-8859-16)"), "ISO-8859-16", LG_OTHER},
+ {N_("South European (ISO-8859-3)"), "ISO-8859-3", LG_OTHER},
+ {N_("Thai (TIS-620)"), "TIS-620", LG_OTHER},
+ {N_("Turkish (IBM-857)"), "IBM857", LG_TURKISH},
+ {N_("Turkish (ISO-8859-9)"), "ISO-8859-9", LG_TURKISH},
+ {N_("Turkish (MacTurkish)"), "x-mac-turkish", LG_TURKISH},
+ {N_("Turkish (Windows-1254)"), "windows-1254", LG_TURKISH},
+ {N_("Unicode (UTF-7)"), "UTF-7", LG_UNICODE},
+ {N_("Unicode (UTF-8)"), "UTF-8", LG_UNICODE},
+ {N_("Unicode (UTF-16BE)"), "UTF-16BE", LG_UNICODE},
+ {N_("Unicode (UTF-16LE)"), "UTF-16LE", LG_UNICODE},
+ {N_("Unicode (UTF-32BE)"), "UTF-32BE", LG_UNICODE},
+ {N_("Unicode (UTF-32LE)"), "UTF-32LE", LG_UNICODE},
+ {N_("User Defined"), "x-user-defined", LG_OTHER},
+ {N_("Vietnamese (TCVN)"), "x-viet-tcvn5712", LG_VIETNAMESE},
+ {N_("Vietnamese (VISCII)"), "VISCII", LG_VIETNAMESE},
+ {N_("Vietnamese (VPS)"), "x-viet-vps", LG_VIETNAMESE},
+ {N_("Vietnamese (Windows-1258)"), "windows-1258", LG_VIETNAMESE},
+ {N_("Visual Hebrew (ISO-8859-8)"), "ISO-8859-8", LG_HEBREW},
+ {N_("Western (IBM-850)"), "IBM850", LG_WESTERN},
+ {N_("Western (ISO-8859-1)"), "ISO-8859-1", LG_WESTERN},
+ {N_("Western (ISO-8859-15)"), "ISO-8859-15", LG_WESTERN},
+ {N_("Western (MacRoman)"), "x-mac-roman", LG_WESTERN},
+ {N_("Western (Windows-1252)"), "windows-1252", LG_WESTERN},
+ /* charsets whithout posibly translatable names */
+ {"T61.8bit", "T61.8bit", LG_OTHER},
+ {"x-imap4-modified-utf7", "x-imap4-modified-utf7", LG_UNICODE},
+ {"x-u-escaped", "x-u-escaped", LG_OTHER}
+};
+
+const gchar *lang_encode_item[LANG_ENC_NUM] =
+{
+ "x-western",
+ "x-central-euro",
+ "ja",
+ "zh-TW",
+ "zh-CN",
+ "ko",
+ "x-cyrillic",
+ "x-baltic",
+ "el",
+ "tr",
+ "x-unicode",
+ "th",
+ "he",
+ "ar"
+};
+
+const gchar *font_types[] =
+{
+ "serif",
+ "sans-serif",
+ "cursive",
+ "fantasy",
+ "monospace"
+};
+
+extern gint
+get_translated_cscount(void)
+{
+ return sizeof (charset_trans_array) / sizeof ((charset_trans_array)[0]);
+}
diff --git a/embed/mozilla/mozilla-i18n.h b/embed/mozilla/mozilla-i18n.h
new file mode 100644
index 000000000..5b5dbc321
--- /dev/null
+++ b/embed/mozilla/mozilla-i18n.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define LANG_ENC_NUM 14
+
+typedef enum {
+ LG_ARABIC,
+ LG_BALTIC,
+ LG_CENTRAL_EUROPEAN,
+ LG_CHINESE,
+ LG_CYRILLIC,
+ LG_GREEK,
+ LG_HEBREW,
+ LG_INDIAN,
+ LG_JAPANESE,
+ LG_KOREAN,
+ LG_TURKISH,
+ LG_UNICODE,
+ LG_VIETNAMESE,
+ LG_WESTERN,
+ LG_OTHER
+} LanguageGroup;
+
+typedef struct {
+ char *charset_title;
+ char *charset_name;
+ LanguageGroup lgroup;
+} CharsetInfoPriv;
+
+/* language groups names */
+extern const char *lgroups[];
+/* translated charset titles */
+extern const CharsetInfoPriv charset_trans_array[];
+
+/* FIXME */
+extern const char *lang_encode_name[LANG_ENC_NUM];
+extern const char *lang_encode_item[LANG_ENC_NUM];
+
+gint get_translated_cscount (void);
+
+G_END_DECLS
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
new file mode 100644
index 000000000..24dfbb7a5
--- /dev/null
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -0,0 +1,710 @@
+/*
+ * Copyright (C) 2000 Nate Case
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "ephy-embed-shell.h"
+#include "mozilla-notifiers.h"
+#include "eel-gconf-extensions.h"
+#include "mozilla-prefs.h"
+#include "MozRegisterComponents.h"
+#include "ephy-prefs.h"
+#include "ephy-embed-prefs.h"
+#include "mozilla-i18n.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <libgnome/gnome-i18n.h>
+#include <stdlib.h>
+#include <sys/utsname.h>
+#include "nsBuildID.h"
+
+static void
+mozilla_own_colors_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+static void
+mozilla_own_fonts_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+
+static void
+mozilla_animate_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+static void
+generic_mozilla_string_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ const char *pref_name);
+static void
+generic_mozilla_int_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ const char *pref_name);
+static void
+generic_mozilla_bool_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ const char *pref_name);
+static void
+mozilla_allow_popups_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+
+static void
+mozilla_language_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+
+static void
+mozilla_autodetect_charset_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyEmbedShell *shell);
+
+static void
+mozilla_default_font_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+
+static void
+mozilla_proxy_mode_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref);
+static void
+mozilla_proxy_autoconfig_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref);
+
+static void
+mozilla_user_agent_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+
+static void
+mozilla_default_charset_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyEmbedShell *shell);
+static void
+mozilla_socks_version_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data);
+
+/* Keeps the list of the notifiers we installed for mozilla prefs */
+/* to be able to remove them when exiting */
+GList *mozilla_notifiers = NULL;
+GList *font_infos = NULL;
+
+enum
+{
+ BOOL_PREF,
+ INT_PREF,
+ STRING_PREF
+};
+
+static const struct
+{
+ char *gconf_key;
+ guint pref_type;
+ const char *mozilla_key;
+}
+conversion_table [] =
+{
+ { CONF_FILTERING_JAVA_ENABLED, BOOL_PREF, "security.enable_java"},
+ { CONF_FILTERING_JAVASCRIPT_ENABLED, BOOL_PREF, "javascript.enabled"},
+ { CONF_FILTERING_IMAGE_LOADING_TYPE, INT_PREF, "network.image.imageBehavior"},
+ { CONF_RENDERING_BG_COLOR, STRING_PREF, "browser.display.background_color"},
+ { CONF_RENDERING_TEXT_COLOR, STRING_PREF, "browser.display.foreground_color"},
+ { CONF_RENDERING_UNVISITED_LINKS, STRING_PREF, "browser.anchor_color"},
+ { CONF_RENDERING_VISITED_LINKS, STRING_PREF, "browser.visited_color"},
+ { CONF_RENDERING_UNDERLINE_LINKS, BOOL_PREF, "browser.underline_anchors"},
+ { CONF_NETWORK_PROXY_AUTO_URL, STRING_PREF, "network.proxy.autoconfig_url"},
+ { CONF_NETWORK_HTTP_PROXY, STRING_PREF, "network.proxy.http"},
+ { CONF_NETWORK_FTP_PROXY, STRING_PREF, "network.proxy.ftp"},
+ { CONF_NETWORK_SSL_PROXY, STRING_PREF, "network.proxy.ssl"},
+ { CONF_NETWORK_SOCKS_PROXY, STRING_PREF, "network.proxy.socks"},
+ { CONF_NETWORK_HTTP_PROXY_PORT, INT_PREF, "network.proxy.http_port"},
+ { CONF_NETWORK_FTP_PROXY_PORT, INT_PREF, "network.proxy.ftp_port"},
+ { CONF_NETWORK_SSL_PROXY_PORT, INT_PREF, "network.proxy.ssl_port"},
+ { CONF_NETWORK_SOCKS_PROXY_PORT, INT_PREF, "network.proxy.socks_port"},
+ { CONF_NETWORK_NO_PROXIES_FOR, STRING_PREF, "network.proxy.no_proxies_on"},
+ { CONF_NETWORK_MEMORY_CACHE, INT_PREF, "browser.cache.memory.capacity"},
+ { CONF_NETWORK_DISK_CACHE, INT_PREF, "browser.cache.disk.capacity"},
+ { CONF_NETWORK_CACHE_COMPARE, INT_PREF, "browser.cache.check_doc_frequency"},
+ { CONF_PERSISTENT_COOKIE_WARN, BOOL_PREF, "network.cookie.warnAboutCookies"},
+ { CONF_PERSISTENT_COOKIES_BEHAVIOR, INT_PREF, "network.cookie.cookieBehavior"},
+ { CONF_PERSISTENT_COOKIE_LIFETIME, BOOL_PREF, "network.cookie.lifetime.enabled"},
+ { CONF_PERSISTENT_PASSWORDS_SAVE, BOOL_PREF, "signon.rememberSignons"},
+ { CONF_RENDERING_USE_SYSTEM_COLORS, BOOL_PREF, "browser.display.use_system_colors"},
+ { NULL, 0, NULL }
+};
+
+static const struct
+{
+ const char *gconf_key;
+ GConfClientNotifyFunc func;
+}
+custom_notifiers [] =
+{
+ { CONF_NETWORK_USER_AGENT,
+ (GConfClientNotifyFunc) mozilla_user_agent_notifier },
+ { CONF_FILTERING_ANIMATE_TYPE,
+ (GConfClientNotifyFunc) mozilla_animate_notifier },
+ { CONF_RENDERING_USE_OWN_COLORS,
+ (GConfClientNotifyFunc) mozilla_own_colors_notifier },
+ { CONF_RENDERING_USE_OWN_FONTS,
+ (GConfClientNotifyFunc) mozilla_own_fonts_notifier },
+ { CONF_FILTERING_ALLOW_POPUPS,
+ (GConfClientNotifyFunc) mozilla_allow_popups_notifier },
+ { CONF_LANGUAGE_DEFAULT_CHARSET,
+ (GConfClientNotifyFunc) mozilla_default_charset_notifier },
+ { CONF_RENDERING_LANGUAGE,
+ (GConfClientNotifyFunc) mozilla_language_notifier },
+ { CONF_LANGUAGE_AUTODETECT_CHARSET,
+ (GConfClientNotifyFunc) mozilla_autodetect_charset_notifier },
+ { CONF_RENDERING_DEFAULT_FONT,
+ (GConfClientNotifyFunc) mozilla_default_font_notifier },
+ { CONF_NETWORK_SOCKS_PROXY_VERSION,
+ (GConfClientNotifyFunc) mozilla_socks_version_notifier },
+ { CONF_NETWORK_PROXY_MODE,
+ (GConfClientNotifyFunc) mozilla_proxy_mode_notifier },
+ { CONF_NETWORK_PROXY_AUTO_URL,
+ (GConfClientNotifyFunc) mozilla_proxy_autoconfig_notifier },
+ {NULL, NULL}
+};
+
+static void
+mozilla_font_size_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref)
+{
+ char key[255];
+
+ sprintf (key, "font.%s", pref);
+
+ mozilla_prefs_set_int (key, gconf_value_get_int(entry->value));
+}
+
+static void
+mozilla_proxy_mode_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref)
+{
+ const char *mode;
+ int mozilla_mode = 0;
+
+ mode = gconf_value_get_string(entry->value);
+
+ if (strcmp (mode, "manual") == 0)
+ {
+ mozilla_mode = 1;
+ }
+ else if (strcmp (mode, "auto") == 0)
+ {
+ mozilla_mode = 2;
+ }
+
+ mozilla_prefs_set_int ("network.proxy.type", mozilla_mode);
+}
+
+static void
+mozilla_font_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref)
+{
+ char key[255];
+
+ sprintf (key, "font.name.%s", pref);
+
+ mozilla_prefs_set_string (key, gconf_value_get_string(entry->value));
+}
+
+static void
+mozilla_proxy_autoconfig_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ char *pref)
+{
+ ephy_embed_shell_load_proxy_autoconf
+ (embed_shell, gconf_value_get_string(entry->value));
+}
+
+void
+mozilla_notifiers_init(MozillaEmbedShell *shell)
+{
+ int i;
+
+ for (i = 0; conversion_table[i].gconf_key != NULL; i++)
+ {
+ GConfClientNotifyFunc func = NULL;
+
+ switch (conversion_table[i].pref_type)
+ {
+ case INT_PREF:
+ func = (GConfClientNotifyFunc) generic_mozilla_int_notifier;
+ break;
+ case BOOL_PREF:
+ func = (GConfClientNotifyFunc) generic_mozilla_bool_notifier;
+ break;
+ case STRING_PREF:
+ func = (GConfClientNotifyFunc) generic_mozilla_string_notifier;
+ break;
+ }
+
+ g_assert (func != NULL);
+
+ ephy_notification_add(
+ conversion_table[i].gconf_key,
+ func,
+ (gpointer)conversion_table[i].mozilla_key,
+ &mozilla_notifiers);
+ }
+
+ for (i = 0; custom_notifiers[i].gconf_key != NULL; i++)
+ {
+ ephy_notification_add(
+ custom_notifiers[i].gconf_key,
+ custom_notifiers[i].func,
+ (gpointer)shell,
+ &mozilla_notifiers);
+ }
+
+ /* fonts notifiers */
+ for (i = 0; i < LANG_ENC_NUM; i++)
+ {
+ int k;
+ char *types [] = { "serif", "sans-serif", "cursive", "fantasy", "monospace" };
+ char key[255];
+ char *info;
+
+ for (k = 0; k < 5; k++)
+ {
+ info = g_strconcat (types[k], ".", lang_encode_item[i], NULL);
+
+ sprintf (key, "%s_%s_%s", CONF_RENDERING_FONT,
+ types[k],
+ lang_encode_item[i]);
+ ephy_notification_add (key,
+ (GConfClientNotifyFunc)mozilla_font_notifier,
+ info,
+ &mozilla_notifiers);
+ font_infos = g_list_append (font_infos, info);
+ }
+
+ sprintf (key, "%s_%s", CONF_RENDERING_FONT_MIN_SIZE, lang_encode_item[i]);
+ info = g_strconcat ("minimum-size", ".", lang_encode_item[i], NULL);
+ ephy_notification_add (key,
+ (GConfClientNotifyFunc)mozilla_font_size_notifier,
+ info,
+ &mozilla_notifiers);
+ font_infos = g_list_append (font_infos, info);
+
+ sprintf (key, "%s_%s", CONF_RENDERING_FONT_FIXED_SIZE, lang_encode_item[i]);
+ info = g_strconcat ("size.fixed", ".", lang_encode_item[i], NULL);
+ ephy_notification_add (key,
+ (GConfClientNotifyFunc)mozilla_font_size_notifier,
+ info,
+ &mozilla_notifiers);
+ font_infos = g_list_append (font_infos, info);
+
+ sprintf (key, "%s_%s", CONF_RENDERING_FONT_VAR_SIZE, lang_encode_item[i]);
+ info = g_strconcat ("size.variable", ".", lang_encode_item[i], NULL);
+ ephy_notification_add (key,
+ (GConfClientNotifyFunc)mozilla_font_size_notifier,
+ info,
+ &mozilla_notifiers);
+ font_infos = g_list_append (font_infos, info);
+ }
+}
+
+void
+mozilla_notifiers_free (void)
+{
+ GList *l;
+
+ ephy_notification_remove (&mozilla_notifiers);
+
+ for (l = font_infos; l != NULL; l = l->next)
+ {
+ g_free (l->data);
+ }
+
+ g_list_free (font_infos);
+}
+
+void
+mozilla_notifiers_set_defaults(void)
+{
+ GConfClient* client = eel_gconf_client_get_global();
+ GConfValue* value;
+ int i;
+
+ for (i = 0; conversion_table[i].gconf_key != NULL; i++)
+ {
+ value = gconf_client_get
+ (client, conversion_table[i].gconf_key, NULL);
+ if (value)
+ {
+ gconf_client_set (client,
+ conversion_table[i].gconf_key,
+ value, NULL);
+ gconf_value_free (value);
+ }
+ }
+
+ for (i = 0; custom_notifiers[i].gconf_key != NULL; i++)
+ {
+ value = gconf_client_get
+ (client, custom_notifiers[i].gconf_key, NULL);
+ if (value)
+ {
+ gconf_client_set (client,
+ custom_notifiers[i].gconf_key,
+ value, NULL);
+ gconf_value_free (value);
+ }
+ }
+}
+
+/**
+ * generic_mozilla_string_notify: update mozilla pref to match epiphany prefs.
+ * user_data should match the mozilla key
+ */
+static void
+generic_mozilla_string_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ const char *pref_name)
+{
+ const gchar *value;
+
+ /* determine type of gconf key, in order of likelyhood */
+ switch (entry->value->type)
+ {
+ case GCONF_VALUE_STRING:
+ value = gconf_value_get_string(entry->value);
+ if (value)
+ {
+ mozilla_prefs_set_string
+ (pref_name,
+ gconf_value_get_string(entry->value));
+ }
+ break;
+
+ default:
+ g_warning("Unsupported variable type");
+ }
+}
+
+
+/**
+ * generic_mozilla_int_notify: update mozilla pref to match epiphany prefs.
+ * user_data should match the mozilla key
+ */
+static void
+generic_mozilla_int_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ const char *pref_name)
+{
+ /* determine type of gconf key, in order of likelyhood */
+ switch (entry->value->type)
+ {
+ case GCONF_VALUE_INT: mozilla_prefs_set_int(pref_name,
+ gconf_value_get_int(entry->value));
+ break;
+ case GCONF_VALUE_BOOL: mozilla_prefs_set_boolean(pref_name,
+ gconf_value_get_bool(entry->value));
+ break;
+ case GCONF_VALUE_STRING: mozilla_prefs_set_string(pref_name,
+ gconf_value_get_string(entry->value));
+ break;
+ default: g_warning("Unsupported variable type");
+ }
+}
+
+
+/**
+ * generic_mozilla_bool_notify: update mozilla pref to match epiphany prefs.
+ * user_data should match the mozilla key
+ */
+static void
+generic_mozilla_bool_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ const char *pref_name)
+{
+ /* determine type of gconf key, in order of likelyhood */
+ switch (entry->value->type)
+ {
+ case GCONF_VALUE_BOOL: mozilla_prefs_set_boolean(pref_name,
+ gconf_value_get_bool(entry->value));
+ break;
+ case GCONF_VALUE_INT: mozilla_prefs_set_int(pref_name,
+ gconf_value_get_int(entry->value));
+ break;
+ default: g_warning("Unsupported variable type");
+ }
+}
+
+static void
+mozilla_default_charset_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyEmbedShell *shell)
+{
+ /* FIXME */
+}
+
+
+static void
+mozilla_own_colors_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ mozilla_prefs_set_boolean("browser.display.use_document_colors",
+ !gconf_value_get_bool(entry->value));
+}
+
+static void
+mozilla_own_fonts_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ mozilla_prefs_set_int("browser.display.use_document_fonts",
+ !gconf_value_get_bool(entry->value));
+}
+
+static void
+mozilla_animate_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ static const gchar *type[] =
+ {
+ "normal",
+ "once",
+ "none"
+ };
+
+ mozilla_prefs_set_string ("image.animation_mode",
+ type[gconf_value_get_int(entry->value)]);
+}
+
+static void
+mozilla_allow_popups_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ gboolean new_val = eel_gconf_get_boolean(CONF_FILTERING_ALLOW_POPUPS);
+ mozilla_prefs_set_boolean ("dom.disable_open_during_load",
+ !new_val);
+}
+
+static void
+mozilla_language_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ gchar *languages;
+ GSList *language_list ,*cur_lang_list;
+
+ language_list = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE);
+
+ languages = NULL;
+ cur_lang_list = language_list;
+ while (cur_lang_list != NULL) {
+ char *lang, *tmp;
+
+ lang = g_strdup((char *)cur_lang_list->data);
+
+ if (languages == NULL)
+ languages = lang;
+ else {
+ tmp = languages;
+ languages = g_strconcat(languages, ",", lang, NULL);
+ g_free(lang);
+ g_free(tmp);
+ }
+ g_free(cur_lang_list->data);
+ cur_lang_list = cur_lang_list->next;
+ }
+
+ if (languages == NULL)
+ {
+ languages = g_strdup ("");
+ }
+
+ mozilla_prefs_set_string ("intl.accept_languages", languages);
+ g_free (languages);
+
+ g_slist_free(language_list);
+}
+
+static char *autodetect_charset_prefs[] =
+{
+ "",
+ "zh_parallel_state_machine",
+ "cjk_parallel_state_machine",
+ "ja_parallel_state_machine",
+ "ko_parallel_state_machine",
+ "ruprob",
+ "zhcn_parallel_state_machine",
+ "zhtw_parallel_state_machine",
+ "ukprob"
+};
+
+static void
+mozilla_autodetect_charset_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyEmbedShell *shell)
+{
+ int charset = eel_gconf_get_integer (CONF_LANGUAGE_AUTODETECT_CHARSET);
+ if (charset < 0 ||
+ charset >= (int)(sizeof(autodetect_charset_prefs)
+ / sizeof(autodetect_charset_prefs[0])))
+ {
+ g_warning ("mozilla_autodetect_charset_notifier: "
+ "unsupported value: %d", charset);
+ return;
+ }
+ mozilla_prefs_set_string ("intl.charset.detector",
+ autodetect_charset_prefs[charset]);
+}
+
+static void
+mozilla_default_font_notifier(GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ const gchar *font_types [] = {"serif","sans-serif"};
+ int default_font;
+
+ default_font = eel_gconf_get_integer (CONF_RENDERING_DEFAULT_FONT);
+ if (default_font < 0 ||
+ default_font >= (int)(sizeof(font_types) / sizeof(font_types[0])))
+ {
+ g_warning ("mozilla_default_font_notifier: "
+ "unsupported value: %d", default_font);
+ return;
+ }
+ mozilla_prefs_set_string ("font.default", font_types[default_font]);
+}
+
+static void
+mozilla_prefs_set_user_agent ()
+{
+ static gchar *default_user_agent = NULL;
+ gchar *value;
+ gchar *user_agent = NULL;
+ struct utsname name;
+ gchar *system;
+
+ if (!default_user_agent)
+ {
+ if (uname (&name) == 0)
+ {
+ system = g_strdup_printf ("%s %s",
+ name.sysname,
+ name.machine);
+ }
+ else
+ {
+ system = g_strdup ("Unknown");
+ }
+
+ default_user_agent = g_strdup_printf
+ ("Mozilla/5.0 Ephy/" VERSION " (X11; %s; U;) Gecko/%d",
+ system,
+ NS_BUILD_ID/100);
+
+ g_free (system);
+ }
+
+ value = eel_gconf_get_string (CONF_NETWORK_USER_AGENT);
+
+ /* now, build a valid user agent string */
+ if (!value || !strcmp ("", value)
+ || !strcmp ("default", value)
+ || !strcmp ("Ephy", value)
+ || !strcmp (_("Default (recommended)"), value)
+ || !strcmp ("Default (recommended)", value))
+ {
+ user_agent = g_strdup (default_user_agent);
+ }
+ else
+ {
+ user_agent = g_strdup (value);
+ }
+
+ mozilla_prefs_set_string ("general.useragent.override", user_agent);
+ g_free (user_agent);
+}
+
+static void
+mozilla_user_agent_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ switch (entry->value->type)
+ {
+ case GCONF_VALUE_STRING:
+ mozilla_prefs_set_user_agent ();
+ break;
+
+ default:
+ g_warning ("Unsupported variable type");
+ break;
+ }
+}
+
+static void
+mozilla_socks_version_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ int version;
+ version = gconf_value_get_int(entry->value) + 4;
+ mozilla_prefs_set_int ("network.proxy.socks_version",
+ version);
+}
diff --git a/embed/mozilla/mozilla-notifiers.h b/embed/mozilla/mozilla-notifiers.h
new file mode 100644
index 000000000..6718365f7
--- /dev/null
+++ b/embed/mozilla/mozilla-notifiers.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2000 Nate Case
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MOZILLA_NOTIFIERS_H
+#define MOZILLA_NOTIFIERS_H
+
+#include "mozilla-embed-shell.h"
+
+void mozilla_notifiers_init (MozillaEmbedShell *shell);
+
+void mozilla_notifiers_set_defaults (void);
+
+void mozilla_notifiers_free (void);
+
+#endif
diff --git a/embed/mozilla/mozilla-prefs.cpp b/embed/mozilla/mozilla-prefs.cpp
new file mode 100644
index 000000000..e5b8c68e2
--- /dev/null
+++ b/embed/mozilla/mozilla-prefs.cpp
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2000-2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "mozilla-prefs.h"
+
+#include <nsCOMPtr.h>
+#include <nsIPrefService.h>
+#include <nsIServiceManager.h>
+#include <nsMemory.h>
+#include <glib/gmessages.h>
+#include <glib/gstrfuncs.h>
+
+gboolean
+mozilla_prefs_save (void)
+{
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ g_return_val_if_fail (prefService != nsnull, FALSE);
+
+ nsresult rv = prefService->SavePrefFile (nsnull);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+}
+
+gboolean
+mozilla_prefs_set_string(const char *preference_name, const char *new_value)
+{
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+ g_return_val_if_fail (new_value != NULL, FALSE);
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ nsresult rv = pref->SetCharPref (preference_name, new_value);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+ }
+
+ return FALSE;
+}
+
+gboolean
+mozilla_prefs_set_boolean (const char *preference_name,
+ gboolean new_boolean_value)
+{
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ nsresult rv = pref->SetBoolPref (preference_name,
+ new_boolean_value ? PR_TRUE : PR_FALSE);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+ }
+ return FALSE;
+}
+
+gboolean
+mozilla_prefs_set_int (const char *preference_name, int new_int_value)
+{
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ nsresult rv = pref->SetIntPref (preference_name, new_int_value);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+ }
+
+ return FALSE;
+}
+
+gboolean
+mozilla_prefs_get_boolean (const char *preference_name,
+ gboolean default_value)
+{
+ PRBool value;
+
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ nsresult result;
+
+ result = pref->GetBoolPref (preference_name, &value);
+ if (NS_FAILED (result)) return default_value;
+ }
+
+ return (value == PR_TRUE) ? TRUE : FALSE;
+}
+
+gint
+mozilla_prefs_get_int (const char *preference_name)
+{
+ int value = -1;
+
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ pref->GetIntPref (preference_name, &value);
+ }
+
+ return value;
+}
+
+gchar *
+mozilla_prefs_get_string(const char *preference_name)
+{
+ gchar *value = NULL;
+ gchar *result = NULL;
+
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ pref->GetCharPref (preference_name, &value);
+ }
+
+ /* it's allocated by mozilla, so I could not g_free it */
+ if (value)
+ {
+ result = g_strdup (value);
+ nsMemory::Free (value);
+ }
+
+ return result;
+}
+
+gboolean
+mozilla_prefs_remove (const char *preference_name)
+{
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ nsresult rv = pref->ClearUserPref (preference_name);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+ }
+
+ return FALSE;
+}
diff --git a/embed/mozilla/mozilla-prefs.h b/embed/mozilla/mozilla-prefs.h
new file mode 100644
index 000000000..82055c4a7
--- /dev/null
+++ b/embed/mozilla/mozilla-prefs.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2000-2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MOZILLA_PREFS_H
+#define MOZILLA_PREFS_H
+
+#include "glib/gtypes.h"
+
+gboolean mozilla_prefs_save (void);
+
+gboolean mozilla_prefs_set_string (const char *preference_name,
+ const char *new_value);
+
+gboolean mozilla_prefs_set_boolean (const char *preference_name,
+ gboolean new_boolean_value);
+
+gboolean mozilla_prefs_set_int (const char *preference_name,
+ int new_int_value);
+
+gboolean mozilla_prefs_get_boolean (const char *preference_name,
+ gboolean default_value);
+
+int mozilla_prefs_get_int (const char *preference_name);
+
+gchar *mozilla_prefs_get_string (const char *preference_name);
+
+gboolean mozilla_prefs_remove (const char *preference_name);
+
+#endif
diff --git a/embed/mozilla/nsUnicharUtils.cpp b/embed/mozilla/nsUnicharUtils.cpp
new file mode 100644
index 000000000..d70619303
--- /dev/null
+++ b/embed/mozilla/nsUnicharUtils.cpp
@@ -0,0 +1,344 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Unicode case conversion helpers.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp..
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Alec Flett <alecf@netscape.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsString.h"
+#include "nsUnicharUtils.h"
+#include "nsReadableUtils.h"
+#include "nsUnicharUtilCIID.h"
+#include "nsICaseConversion.h"
+#include "nsIServiceManager.h"
+#include "nsCRT.h"
+
+#include "nsIObserver.h"
+#include "nsIObserverService.h"
+
+// global cache of the case conversion service
+static nsICaseConversion *gCaseConv = nsnull;
+
+class nsShutdownObserver : public nsIObserver
+{
+public:
+ nsShutdownObserver() { NS_INIT_ISUPPORTS(); }
+ virtual ~nsShutdownObserver() {}
+ NS_DECL_ISUPPORTS
+
+ NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic,
+ const PRUnichar *aData)
+ {
+ if (nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)==0) {
+ NS_IF_RELEASE(gCaseConv);
+ }
+
+ return NS_OK;
+ }
+
+};
+
+NS_IMPL_ISUPPORTS1(nsShutdownObserver, nsIObserver)
+
+static nsresult NS_InitCaseConversion() {
+ if (gCaseConv) return NS_OK;
+
+ nsresult rv;
+
+ rv = CallGetService(NS_UNICHARUTIL_CONTRACTID, &gCaseConv);
+
+ if (NS_SUCCEEDED(rv)) {
+ nsCOMPtr<nsIObserverService> obs =
+ do_GetService("@mozilla.org/observer-service;1", &rv);
+ if (NS_SUCCEEDED(rv)) {
+ nsShutdownObserver *observer = new nsShutdownObserver();
+ if (observer)
+ obs->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
+ }
+ }
+
+ return NS_OK;
+}
+
+class ConvertToLowerCase
+{
+public:
+ typedef PRUnichar value_type;
+
+ ConvertToLowerCase()
+ {
+ NS_InitCaseConversion();
+ }
+
+ PRUint32 write( const PRUnichar* aSource, PRUint32 aSourceLength)
+ {
+ if (gCaseConv)
+ gCaseConv->ToLower(aSource, NS_CONST_CAST(PRUnichar*,aSource), aSourceLength);
+ else
+ NS_WARNING("No case converter: no conversion done");
+
+ return aSourceLength;
+ }
+};
+
+void
+ToLowerCase( nsAString& aString )
+ {
+ nsAString::iterator fromBegin, fromEnd;
+ ConvertToLowerCase converter;
+ copy_string(aString.BeginWriting(fromBegin), aString.EndWriting(fromEnd), converter);
+ }
+
+void
+ToLowerCase( nsASingleFragmentString& aString )
+ {
+ ConvertToLowerCase converter;
+ PRUnichar* start;
+ converter.write(aString.BeginWriting(start), aString.Length());
+ }
+
+void
+ToLowerCase( nsString& aString )
+ {
+ ConvertToLowerCase converter;
+ converter.write(aString.mUStr, aString.mLength);
+ }
+
+class CopyToLowerCase
+ {
+ public:
+ typedef PRUnichar value_type;
+
+ CopyToLowerCase( nsAString::iterator& aDestIter )
+ : mIter(aDestIter)
+ {
+ NS_InitCaseConversion();
+ }
+
+ PRUint32 write( const PRUnichar* aSource, PRUint32 aSourceLength )
+ {
+ PRUint32 len = PR_MIN(PRUint32(mIter.size_forward()), aSourceLength);
+ PRUnichar* dest = NS_CONST_CAST(PRUnichar*, mIter.get());
+ if (gCaseConv)
+ gCaseConv->ToLower(aSource, dest, len);
+ else {
+ NS_WARNING("No case converter: only copying");
+ memcpy((void*)aSource, (void*)dest, len * sizeof(*aSource));
+ }
+ mIter.advance(len);
+ return len;
+ }
+
+ protected:
+ nsAString::iterator& mIter;
+ };
+
+void
+ToLowerCase( const nsAString& aSource, nsAString& aDest )
+ {
+ nsAString::const_iterator fromBegin, fromEnd;
+ nsAString::iterator toBegin;
+ aDest.SetLength(aSource.Length());
+ CopyToLowerCase converter(aDest.BeginWriting(toBegin));
+ copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+ }
+
+class ConvertToUpperCase
+{
+public:
+ typedef PRUnichar value_type;
+
+ ConvertToUpperCase()
+ {
+ NS_InitCaseConversion();
+ }
+
+ PRUint32 write( const PRUnichar* aSource, PRUint32 aSourceLength)
+ {
+ if (gCaseConv)
+ gCaseConv->ToUpper(aSource, NS_CONST_CAST(PRUnichar*,aSource), aSourceLength);
+ else
+ NS_WARNING("No case converter: no conversion done");
+
+ return aSourceLength;
+ }
+};
+
+void
+ToUpperCase( nsAString& aString )
+ {
+ nsAString::iterator fromBegin, fromEnd;
+ ConvertToUpperCase converter;
+ copy_string(aString.BeginWriting(fromBegin), aString.EndWriting(fromEnd), converter);
+ }
+
+void
+ToUpperCase( nsASingleFragmentString& aString )
+ {
+ ConvertToUpperCase converter;
+ PRUnichar* start;
+ converter.write(aString.BeginWriting(start), aString.Length());
+ }
+
+void
+ToUpperCase( nsString& aString )
+ {
+ ConvertToUpperCase converter;
+ converter.write(aString.mUStr, aString.mLength);
+ }
+
+class CopyToUpperCase
+ {
+ public:
+ typedef PRUnichar value_type;
+
+ CopyToUpperCase( nsAString::iterator& aDestIter )
+ : mIter(aDestIter)
+ {
+ NS_InitCaseConversion();
+ }
+
+ PRUint32 write( const PRUnichar* aSource, PRUint32 aSourceLength )
+ {
+ PRUint32 len = PR_MIN(PRUint32(mIter.size_forward()), aSourceLength);
+ PRUnichar* dest = NS_CONST_CAST(PRUnichar*, mIter.get());
+ if (gCaseConv)
+ gCaseConv->ToUpper(aSource, dest, len);
+ else {
+ NS_WARNING("No case converter: only copying");
+ memcpy((void*)aSource, (void*)dest, len * sizeof(*aSource));
+ }
+ mIter.advance(len);
+ return len;
+ }
+
+ protected:
+ nsAString::iterator& mIter;
+ };
+
+void
+ToUpperCase( const nsAString& aSource, nsAString& aDest )
+ {
+ nsAString::const_iterator fromBegin, fromEnd;
+ nsAString::iterator toBegin;
+ aDest.SetLength(aSource.Length());
+ CopyToUpperCase converter(aDest.BeginWriting(toBegin));
+ copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+ }
+
+PRBool
+CaseInsensitiveFindInReadable( const nsAString& aPattern, nsAString::const_iterator& aSearchStart, nsAString::const_iterator& aSearchEnd )
+{
+ return FindInReadable(aPattern, aSearchStart, aSearchEnd, nsCaseInsensitiveStringComparator());
+}
+
+
+int
+nsCaseInsensitiveStringComparator::operator()( const PRUnichar* lhs, const PRUnichar* rhs, PRUint32 aLength ) const
+ {
+ NS_InitCaseConversion();
+ PRInt32 result;
+ if (gCaseConv) {
+ gCaseConv->CaseInsensitiveCompare(lhs, rhs, aLength, &result);
+ }
+ else {
+ NS_WARNING("No case converter: using default");
+ nsDefaultStringComparator comparator;
+ result = comparator(lhs, rhs, aLength);
+ }
+ return result;
+ }
+
+int
+nsCaseInsensitiveStringComparator::operator()( PRUnichar lhs, PRUnichar rhs ) const
+ {
+ // see if they're an exact match first
+ if (lhs == rhs) return 0;
+
+ NS_InitCaseConversion();
+
+ if (gCaseConv) {
+ gCaseConv->ToLower(lhs, &lhs);
+ gCaseConv->ToLower(rhs, &rhs);
+ } else {
+ if (lhs < 256)
+ lhs = tolower(char(lhs));
+ if (rhs < 256)
+ rhs = tolower(char(rhs));
+ NS_WARNING("No case converter: no conversion done");
+ }
+
+ if (lhs == rhs) return 0;
+ if (lhs < rhs) return -1;
+ return 1;
+ }
+
+PRUnichar
+ToLowerCase(PRUnichar aChar)
+{
+ PRUnichar result;
+ if (NS_FAILED(NS_InitCaseConversion()))
+ return aChar;
+
+ if (gCaseConv)
+ gCaseConv->ToLower(aChar, &result);
+ else {
+ NS_WARNING("No case converter: no conversion done");
+ if (aChar < 256)
+ result = tolower(char(aChar));
+ else
+ result = aChar;
+ }
+ return result;
+}
+
+PRUnichar
+ToUpperCase(PRUnichar aChar)
+{
+ PRUnichar result;
+ if (NS_FAILED(NS_InitCaseConversion()))
+ return aChar;
+
+ if (gCaseConv)
+ gCaseConv->ToUpper(aChar, &result);
+ else {
+ NS_WARNING("No case converter: no conversion done");
+ if (aChar < 256)
+ result = toupper(char(aChar));
+ else
+ result = aChar;
+ }
+ return result;
+}
+
diff --git a/embed/mozilla/nsUnicharUtils.h b/embed/mozilla/nsUnicharUtils.h
new file mode 100644
index 000000000..6ae9a238d
--- /dev/null
+++ b/embed/mozilla/nsUnicharUtils.h
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Unicode case conversion helpers.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp..
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Alec Flett <alecf@netscape.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsUnicharUtils_h__
+#define nsUnicharUtils_h__
+#ifndef nsAString_h___
+#include "nsAString.h"
+#endif
+
+class nsASingleFragmentString;
+class nsString;
+
+void ToLowerCase( nsAString& );
+void ToUpperCase( nsAString& );
+
+void ToLowerCase( nsASingleFragmentString& );
+void ToUpperCase( nsASingleFragmentString& );
+
+void ToLowerCase( nsString& );
+void ToUpperCase( nsString& );
+
+void ToLowerCase( const nsAString& aSource, nsAString& aDest );
+void ToUpperCase( const nsAString& aSource, nsAString& aDest );
+
+PRBool CaseInsensitiveFindInReadable( const nsAString& aPattern, nsAString::const_iterator&, nsAString::const_iterator& );
+
+class nsCaseInsensitiveStringComparator
+ : public nsStringComparator
+ {
+ public:
+ virtual int operator()( const PRUnichar*, const PRUnichar*, PRUint32 aLength ) const;
+ virtual int operator()( PRUnichar, PRUnichar ) const;
+ };
+
+
+PRUnichar ToUpperCase(PRUnichar);
+PRUnichar ToLowerCase(PRUnichar);
+
+inline PRBool IsUpperCase(PRUnichar c) {
+ return ToLowerCase(c) != c;
+}
+
+inline PRBool IsLowerCase(PRUnichar c) {
+ return ToUpperCase(c) != c;
+}
+
+#define IS_HIGH_SURROGATE(u) ((PRUnichar)(u) >= (PRUnichar)0xd800 && (PRUnichar)(u) <= (PRUnichar)0xdbff)
+#define IS_LOW_SURROGATE(u) ((PRUnichar)(u) >= (PRUnichar)0xdc00 && (PRUnichar)(u) <= (PRUnichar)0xdfff)
+
+#define SURROGATE_TO_UCS4(h, l) ((((PRUint32)(h)-(PRUint32)0xd800) << 10) + \
+ (PRUint32)(l) - (PRUint32)(0xdc00) + 0x10000)
+
+/* (0x3131u <= (u) && (u) <= 0x318eu) => Hangul Compatibility Jamo */
+/* (0xac00u <= (u) && (u) <= 0xd7a3u) => Hangul Syllables */
+#define IS_CJ_CHAR(u) \
+ ((0x2e80u <= (u) && (u) <= 0x312fu) || \
+ (0x3190u <= (u) && (u) <= 0xabffu) || \
+ (0xf900u <= (u) && (u) <= 0xfaffu) || \
+ (0xff00u <= (u) && (u) <= 0xffffu) )
+
+#endif /* nsUnicharUtils_h__ */
diff --git a/embed/print-dialog.c b/embed/print-dialog.c
new file mode 100755
index 000000000..09929376c
--- /dev/null
+++ b/embed/print-dialog.c
@@ -0,0 +1,402 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "print-dialog.h"
+#include "ephy-prefs.h"
+#include <gtk/gtkdialog.h>
+
+#define CONF_PRINT_BOTTOM_MARGIN "/apps/epiphany/print/bottom_margin"
+#define CONF_PRINT_TOP_MARGIN "/apps/epiphany/print/top_margin"
+#define CONF_PRINT_LEFT_MARGIN "/apps/epiphany/print/left_margin"
+#define CONF_PRINT_RIGHT_MARGIN "/apps/epiphany/print/right_margin"
+#define CONF_PRINT_PAGE_TITLE "/apps/epiphany/print/page_title_toggle"
+#define CONF_PRINT_PAGE_URL "/apps/epiphany/print/page_url_toggle"
+#define CONF_PRINT_DATE "/apps/epiphany/print/date_toggle"
+#define CONF_PRINT_PAGE_NUMBERS "/apps/epiphany/print/page_numbers_toggle"
+#define CONF_PRINT_PRINTER "/apps/epiphany/print/printer"
+#define CONF_PRINT_FILE "/apps/epiphany/print/file"
+#define CONF_PRINT_PRINTON "/apps/epiphany/print/printon"
+#define CONF_PRINT_PAPER "/apps/epiphany/print/paper"
+#define CONF_PRINT_ALL_PAGES "/apps/epiphany/print/all_pages"
+#define CONF_PRINT_START_FROM_LAST "/apps/epiphany/print/start_from_last"
+#define CONF_PRINT_COLOR "/apps/epiphany/print/color"
+#define CONF_PRINT_ORIENTATION "/apps/epiphany/print/orientation"
+
+static void print_dialog_class_init (PrintDialogClass *klass);
+static void print_dialog_init (PrintDialog *dialog);
+static void print_dialog_finalize (GObject *object);
+
+/* Glade callbacks */
+void
+print_cancel_button_cb (GtkWidget *widget,
+ EphyDialog *dialog);
+void
+print_ok_button_cb (GtkWidget *widget,
+ EphyDialog *dialog);
+void
+print_preview_button_cb (GtkWidget *widget,
+ EphyDialog *dialog);
+
+static GObjectClass *parent_class = NULL;
+
+struct PrintDialogPrivate
+{
+ gpointer dummy;
+};
+
+enum
+{
+ PRINTON_PROP,
+ PRINTER_PROP,
+ FILE_PROP,
+ PAPER_PROP,
+ TOP_PROP,
+ BOTTOM_PROP,
+ LEFT_PROP,
+ RIGHT_PROP,
+ PAGE_TITLE_PROP,
+ PAGE_URL_PROP,
+ PAGE_NUMBERS_PROP,
+ DATE_PROP,
+ ALL_PAGES_PROP,
+ TO_PROP,
+ FROM_PROP,
+ COLOR_PROP,
+ ORIENTATION_PROP
+};
+
+enum
+{
+ PREVIEW,
+ LAST_SIGNAL
+};
+
+static const
+EphyDialogProperty properties [] =
+{
+ { PRINTON_PROP, "printer_radiobutton", CONF_PRINT_PRINTON, PT_NORMAL, NULL },
+ { PRINTER_PROP, "printer_entry", CONF_PRINT_PRINTER, PT_NORMAL, NULL },
+ { FILE_PROP, "file_entry", CONF_PRINT_FILE, PT_NORMAL, NULL },
+ { PAPER_PROP,"letter_radiobutton", CONF_PRINT_PAPER, PT_NORMAL, NULL },
+ { TOP_PROP, "top_spinbutton", CONF_PRINT_TOP_MARGIN, PT_NORMAL, NULL },
+ { BOTTOM_PROP, "bottom_spinbutton", CONF_PRINT_BOTTOM_MARGIN, PT_NORMAL, NULL },
+ { LEFT_PROP,"left_spinbutton", CONF_PRINT_LEFT_MARGIN, PT_NORMAL, NULL },
+ { RIGHT_PROP, "right_spinbutton", CONF_PRINT_RIGHT_MARGIN, PT_NORMAL, NULL },
+ { PAGE_TITLE_PROP, "print_page_title_checkbutton", CONF_PRINT_PAGE_TITLE, PT_NORMAL, NULL },
+ { PAGE_URL_PROP, "print_page_url_checkbutton", CONF_PRINT_PAGE_URL, PT_NORMAL, NULL },
+ { PAGE_NUMBERS_PROP, "print_page_numbers_checkbutton", CONF_PRINT_PAGE_NUMBERS, PT_NORMAL, NULL },
+ { DATE_PROP, "print_date_checkbutton", CONF_PRINT_DATE, PT_NORMAL, NULL },
+ { ALL_PAGES_PROP, "all_pages_radiobutton", CONF_PRINT_ALL_PAGES, PT_NORMAL, NULL },
+ { TO_PROP, "to_spinbutton", NULL, PT_NORMAL, NULL },
+ { FROM_PROP, "from_spinbutton", NULL, PT_NORMAL, NULL },
+ { COLOR_PROP, "print_color_radiobutton", CONF_PRINT_COLOR, PT_NORMAL, NULL },
+ { ORIENTATION_PROP, "orient_p_radiobutton", CONF_PRINT_ORIENTATION, PT_NORMAL, NULL },
+
+ { -1, NULL, NULL }
+};
+
+static guint print_dialog_signals[LAST_SIGNAL] = { 0 };
+
+GType
+print_dialog_get_type (void)
+{
+ static GType print_dialog_type = 0;
+
+ if (print_dialog_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (PrintDialogClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) print_dialog_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (PrintDialog),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) print_dialog_init
+ };
+
+ print_dialog_type = g_type_register_static (EPHY_EMBED_DIALOG_TYPE,
+ "PrintDialog",
+ &our_info, 0);
+ }
+
+ return print_dialog_type;
+
+}
+
+static void
+print_dialog_class_init (PrintDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = print_dialog_finalize;
+
+ print_dialog_signals[PREVIEW] =
+ g_signal_new ("preview",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (PrintDialogClass, preview),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+static void
+print_dialog_init (PrintDialog *dialog)
+{
+ dialog->priv = g_new0 (PrintDialogPrivate, 1);
+
+ dialog->only_collect_info = FALSE;
+
+ dialog->ret_info = NULL;
+
+ ephy_dialog_construct (EPHY_DIALOG(dialog),
+ properties,
+ "print.glade", "print_dialog");
+}
+
+static void
+print_dialog_finalize (GObject *object)
+{
+ PrintDialog *dialog;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_PRINT_DIALOG (object));
+
+ dialog = PRINT_DIALOG (object);
+
+ g_return_if_fail (dialog->priv != NULL);
+
+ g_free (dialog->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+EphyDialog *
+print_dialog_new (EphyEmbed *embed,
+ EmbedPrintInfo **ret_info)
+{
+ PrintDialog *dialog;
+
+ dialog = PRINT_DIALOG (g_object_new (PRINT_DIALOG_TYPE,
+ "EphyEmbed", embed,
+ NULL));
+
+ if (!embed) dialog->only_collect_info = TRUE;
+ dialog->ret_info = ret_info;
+
+ return EPHY_DIALOG(dialog);
+}
+
+EphyDialog *
+print_dialog_new_with_parent (GtkWidget *window,
+ EphyEmbed *embed,
+ EmbedPrintInfo **ret_info)
+{
+ PrintDialog *dialog;
+
+ dialog = PRINT_DIALOG (g_object_new (PRINT_DIALOG_TYPE,
+ "EphyEmbed", embed,
+ "ParentWindow", window,
+ NULL));
+
+ if (!embed) dialog->only_collect_info = TRUE;
+ dialog->ret_info = ret_info;
+
+ return EPHY_DIALOG(dialog);
+}
+
+void
+print_free_info (EmbedPrintInfo *info)
+{
+ g_free (info->printer);
+ g_free (info->file);
+ g_free (info->header_left_string);
+ g_free (info->header_right_string);
+ g_free (info->footer_left_string);
+ g_free (info->footer_right_string);
+ g_free (info);
+}
+
+static EmbedPrintInfo *
+print_get_info (EphyDialog *dialog)
+{
+ EmbedPrintInfo *info;
+ GValue print_to_file = {0, };
+ GValue printer = {0, };
+ GValue file = {0, };
+ GValue top_margin = {0, };
+ GValue bottom_margin = {0, };
+ GValue left_margin = {0, };
+ GValue right_margin = {0, };
+ GValue from_page = {0, };
+ GValue to_page = {0, };
+ GValue paper = {0, };
+ GValue pages = {0, };
+ GValue print_color = {0, };
+ GValue orientation = {0, };
+ GValue page_title = {0, };
+ GValue page_url = {0, };
+ GValue date = {0, };
+ GValue page_numbers = {0, };
+
+ info = g_new0 (EmbedPrintInfo, 1);
+
+ ephy_dialog_get_value (dialog, PRINTON_PROP, &print_to_file);
+ info->print_to_file = g_value_get_int (&print_to_file);
+
+ ephy_dialog_get_value (dialog, PRINTER_PROP, &printer);
+ info->printer = g_strdup (g_value_get_string (&printer));
+
+ ephy_dialog_get_value (dialog, FILE_PROP, &file);
+ info->file = g_strdup (g_value_get_string (&file));
+
+ ephy_dialog_get_value (dialog, BOTTOM_PROP, &bottom_margin);
+ info->bottom_margin = g_value_get_float (&bottom_margin);
+
+ ephy_dialog_get_value (dialog, LEFT_PROP, &left_margin);
+ info->left_margin = g_value_get_float (&left_margin);
+
+ ephy_dialog_get_value (dialog, TOP_PROP, &top_margin);
+ info->top_margin = g_value_get_float (&top_margin);
+
+ ephy_dialog_get_value (dialog, RIGHT_PROP, &right_margin);
+ info->right_margin = g_value_get_float (&right_margin);
+
+ ephy_dialog_get_value (dialog, FROM_PROP, &from_page);
+ info->from_page = g_value_get_float (&from_page);
+
+ ephy_dialog_get_value (dialog, TO_PROP, &to_page);
+ info->to_page = g_value_get_float (&to_page);
+
+ ephy_dialog_get_value (dialog, PAPER_PROP, &paper);
+ info->paper = g_value_get_int (&paper);
+
+ ephy_dialog_get_value (dialog, ALL_PAGES_PROP, &pages);
+ info->pages = g_value_get_int (&pages);
+
+ ephy_dialog_get_value (dialog, COLOR_PROP, &print_color);
+ info->print_color = g_value_get_int (&print_color);
+
+ ephy_dialog_get_value (dialog, ORIENTATION_PROP, &orientation);
+ info->orientation = g_value_get_int (&orientation);
+
+ info->frame_type = 0;
+
+ ephy_dialog_get_value (dialog, PAGE_TITLE_PROP, &page_title);
+ info->header_left_string = g_value_get_boolean (&page_title) ?
+ g_strdup ("&T") : g_strdup ("");
+
+ ephy_dialog_get_value (dialog, PAGE_URL_PROP, &page_url);
+ info->header_right_string = g_value_get_boolean (&page_url) ?
+ g_strdup ("&U") : g_strdup ("");
+
+ ephy_dialog_get_value (dialog, PAGE_NUMBERS_PROP, &page_numbers);
+ info->footer_left_string = g_value_get_boolean (&page_numbers) ?
+ g_strdup ("&PT") : g_strdup ("");
+
+ ephy_dialog_get_value (dialog, DATE_PROP, &date);
+ info->footer_right_string = g_value_get_boolean (&date) ?
+ g_strdup ("&D") : g_strdup ("");
+
+ info->header_center_string = g_strdup("");
+ info->footer_center_string = g_strdup("");
+
+ return info;
+}
+
+static void
+print_dialog_print (EphyDialog *dialog)
+{
+ EmbedPrintInfo *info;
+ EphyEmbed *embed;
+
+ info = print_get_info (dialog);
+
+ if(PRINT_DIALOG(dialog)->only_collect_info && PRINT_DIALOG(dialog)->ret_info)
+ {
+ *(PRINT_DIALOG(dialog)->ret_info) = info;
+ }
+ else
+ {
+ embed = ephy_embed_dialog_get_embed
+ (EPHY_EMBED_DIALOG(dialog));
+
+ info->preview = FALSE;
+ ephy_embed_print (embed, info);
+ print_free_info (info);
+ }
+
+ g_object_unref (G_OBJECT(dialog));
+}
+
+static void
+print_dialog_preview (EphyDialog *dialog)
+{
+ EmbedPrintInfo *info;
+ EphyEmbed *embed;
+
+ info = print_get_info (dialog);
+
+ if(PRINT_DIALOG(dialog)->only_collect_info && PRINT_DIALOG(dialog)->ret_info)
+ {
+ *(PRINT_DIALOG(dialog)->ret_info) = info;
+ }
+ else
+ {
+ embed = ephy_embed_dialog_get_embed
+ (EPHY_EMBED_DIALOG(dialog));
+
+ info->preview = TRUE;
+ ephy_embed_print (embed, info);
+ print_free_info (info);
+ }
+ g_signal_emit (G_OBJECT (dialog), print_dialog_signals[PREVIEW], 0);
+
+ g_object_unref (G_OBJECT(dialog));
+}
+
+void
+print_cancel_button_cb (GtkWidget *widget,
+ EphyDialog *dialog)
+{
+ g_object_unref (G_OBJECT(dialog));
+}
+
+void
+print_ok_button_cb (GtkWidget *widget,
+ EphyDialog *dialog)
+{
+ print_dialog_print (dialog);
+}
+
+void
+print_preview_button_cb (GtkWidget *widget,
+ EphyDialog *dialog)
+{
+ //FIXME: Don't show preview button at all.
+ if(!(PRINT_DIALOG(dialog)->only_collect_info))
+ print_dialog_preview (dialog);
+}
+
+
diff --git a/embed/print-dialog.h b/embed/print-dialog.h
new file mode 100644
index 000000000..5342f0223
--- /dev/null
+++ b/embed/print-dialog.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PRINT_DIALOG_H
+#define PRINT_DIALOG_H
+
+#include "ephy-embed-dialog.h"
+#include "ephy-embed.h"
+
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct PrintDialog PrintDialog;
+typedef struct PrintDialogClass PrintDialogClass;
+
+#define PRINT_DIALOG_TYPE (print_dialog_get_type ())
+#define PRINT_DIALOG(obj) (GTK_CHECK_CAST ((obj), PRINT_DIALOG_TYPE, PrintDialog))
+#define PRINT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), PRINT_DIALOG, PrintDialogClass))
+#define IS_PRINT_DIALOG(obj) (GTK_CHECK_TYPE ((obj), PRINT_DIALOG_TYPE))
+#define IS_PRINT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), PRINT_DIALOG))
+
+typedef struct PrintDialogPrivate PrintDialogPrivate;
+
+struct PrintDialog
+{
+ EphyEmbedDialog parent;
+ PrintDialogPrivate *priv;
+ //FIXME: These should be gobject properties
+ gboolean only_collect_info;
+ EmbedPrintInfo **ret_info;
+};
+
+struct PrintDialogClass
+{
+ EphyEmbedDialogClass parent_class;
+
+ void (* preview) (PrintDialog *dialog);
+};
+
+GType print_dialog_get_type (void);
+
+EphyDialog *print_dialog_new (EphyEmbed *embed,
+ EmbedPrintInfo **ret_info);
+
+EphyDialog *print_dialog_new_with_parent (GtkWidget *window,
+ EphyEmbed *embed,
+ EmbedPrintInfo **ret_info);
+
+gboolean print_dialog_is_preview (PrintDialog *dialog);
+
+void print_free_info (EmbedPrintInfo *info);
+
+G_END_DECLS
+
+#endif
+
diff --git a/idl/EphyAutomation.idl b/idl/EphyAutomation.idl
new file mode 100644
index 000000000..090fd51f3
--- /dev/null
+++ b/idl/EphyAutomation.idl
@@ -0,0 +1,27 @@
+#include <Bonobo.idl>
+
+module GNOME {
+
+ interface EphyAutomation : Bonobo::Unknown {
+ boolean loadurl (in string url,
+ in string geometry,
+ in boolean fullscreen,
+ in boolean open_in_existing_tab,
+ in boolean open_in_new_tab,
+ in boolean open_in_new_window,
+ in boolean raise);
+
+ boolean addBookmark (in string url);
+
+ /**
+ * Closes all opened windows.
+ * if disableServer is true,
+ * server mode is disbaled
+ * (and Galeon exits)
+ */
+ boolean quit (in boolean disableServer);
+
+ boolean loadSession (in string filename);
+ };
+};
+
diff --git a/lib/.cvsignore b/lib/.cvsignore
new file mode 100644
index 000000000..20e4cb0c8
--- /dev/null
+++ b/lib/.cvsignore
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+*.lo
+.deps
+.libs
+*.la
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644
index 000000000..60092472f
--- /dev/null
+++ b/lib/Makefile.am
@@ -0,0 +1,73 @@
+SUBDIRS = widgets toolbar
+
+INCLUDES = \
+ $(WARN_CFLAGS) \
+ $(EPIPHANY_DEPENDENCY_CFLAGS) \
+ -DSHARE_DIR=\"$(pkgdatadir)\" \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGNOME_DISABLE_DEPRECATED
+
+noinst_LTLIBRARIES = libephy.la
+
+libephy_la_SOURCES = \
+ ephy-types.h \
+ ephy-prefs.h \
+ ephy-gobject-misc.h \
+ eel-gconf-extensions.c \
+ eel-gconf-extensions.h \
+ ephy-dialog.c \
+ ephy-dialog.h \
+ ephy-dnd.c \
+ ephy-dnd.h \
+ ephy-marshal.c \
+ ephy-marshal.h \
+ ephy-types.h \
+ ephy-bonobo-extensions.h \
+ ephy-bonobo-extensions.c \
+ ephy-file-helpers.c \
+ ephy-file-helpers.h \
+ ephy-glade.c \
+ ephy-glade.h \
+ ephy-gui.c \
+ ephy-gui.h \
+ ephy-prefs-utils.c \
+ ephy-prefs-utils.h \
+ ephy-state.c \
+ ephy-state.h \
+ ephy-string.c \
+ ephy-string.h \
+ ephy-autocompletion.c \
+ ephy-autocompletion.h \
+ ephy-autocompletion-source.c \
+ ephy-autocompletion-source.h \
+ ephy-stock-icons.c \
+ ephy-stock-icons.h \
+ ephy-filesystem-autocompletion.c \
+ ephy-filesystem-autocompletion.h \
+ ephy-thread-helpers.c \
+ ephy-thread-helpers.h \
+ ephy-node.c \
+ ephy-node.h \
+ ephy-node-filter.c \
+ ephy-node-filter.h
+
+libephy_la_LIBADD = \
+ $(top_builddir)/lib/widgets/libephywidgets.la \
+ $(top_builddir)/lib/toolbar/libephytoolbar.la
+
+BUILT_SOURCES=ephy-marshal.c ephy-marshal.h
+
+CLEAN_FILES = $(BUILT_SOURCES)
+
+ephy-marshal.c: ephy-marshal.list
+ @GLIB_GENMARSHAL@ --prefix=ephy_marshal $(srcdir)/ephy-marshal.list --header --body > ephy-marshal.c
+
+ephy-marshal.h: ephy-marshal.list
+ @GLIB_GENMARSHAL@ --prefix=ephy_marshal $(srcdir)/ephy-marshal.list --header > ephy-marshal.h
+
+EXTRA_DIST = \
+ ephy-marshal.list
+
diff --git a/lib/eel-gconf-extensions.c b/lib/eel-gconf-extensions.c
new file mode 100644
index 000000000..e6593219a
--- /dev/null
+++ b/lib/eel-gconf-extensions.c
@@ -0,0 +1,556 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* eel-gconf-extensions.c - Stuff to make GConf easier to use.
+
+ Copyright (C) 2000, 2001 Eazel, Inc.
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Authors: Ramiro Estrugo <ramiro@eazel.com>
+*/
+
+#include <stdlib.h>
+#include <config.h>
+#include "eel-gconf-extensions.h"
+
+#include <gconf/gconf-client.h>
+#include <gconf/gconf.h>
+#include <gtk/gtkwidget.h>
+#include <libgnome/gnome-i18n.h>
+#include <gtk/gtkmessagedialog.h>
+
+static GConfClient *global_gconf_client = NULL;
+
+static void
+global_client_free (void)
+{
+ if (global_gconf_client == NULL) {
+ return;
+ }
+
+ g_object_unref (G_OBJECT (global_gconf_client));
+ global_gconf_client = NULL;
+}
+
+/* Public */
+GConfClient *
+eel_gconf_client_get_global (void)
+{
+ /* Initialize gconf if needed */
+ if (!gconf_is_initialized ()) {
+ char *argv[] = { "eel-preferences", NULL };
+ GError *error = NULL;
+
+ if (!gconf_init (1, argv, &error)) {
+ if (eel_gconf_handle_error (&error)) {
+ return NULL;
+ }
+ }
+
+ }
+
+ if (global_gconf_client == NULL) {
+ global_gconf_client = gconf_client_get_default ();
+ g_atexit (global_client_free);
+ }
+
+ return global_gconf_client;
+}
+
+gboolean
+eel_gconf_handle_error (GError **error)
+{
+ g_return_val_if_fail (error != NULL, FALSE);
+
+ if (*error != NULL) {
+ g_warning (_("GConf error:\n %s"), (*error)->message);
+ g_error_free (*error);
+ *error = NULL;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void
+eel_gconf_set_boolean (const char *key,
+ gboolean boolean_value)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_set_bool (client, key, boolean_value, &error);
+ eel_gconf_handle_error (&error);
+}
+
+gboolean
+eel_gconf_get_boolean (const char *key)
+{
+ gboolean result;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, FALSE);
+
+ result = gconf_client_get_bool (client, key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ result = FALSE;
+ }
+
+ return result;
+}
+
+void
+eel_gconf_set_integer (const char *key,
+ int int_value)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_set_int (client, key, int_value, &error);
+ eel_gconf_handle_error (&error);
+}
+
+int
+eel_gconf_get_integer (const char *key)
+{
+ int result;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, 0);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, 0);
+
+ result = gconf_client_get_int (client, key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ result = 0;
+ }
+
+ return result;
+}
+
+void
+eel_gconf_set_float (const char *key,
+ gfloat float_value)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_set_float (client, key, float_value, &error);
+ eel_gconf_handle_error (&error);
+}
+
+gfloat
+eel_gconf_get_float (const char *key)
+{
+ gfloat result;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, 0);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, 0);
+
+ result = gconf_client_get_float (client, key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ result = 0;
+ }
+
+ return result;
+}
+
+void
+eel_gconf_set_string (const char *key,
+ const char *string_value)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_if_fail (key != NULL);
+ g_return_if_fail (string_value != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_set_string (client, key, string_value, &error);
+ eel_gconf_handle_error (&error);
+}
+
+void
+eel_gconf_unset (const char *key)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_unset (client, key, &error);
+ eel_gconf_handle_error (&error);
+}
+
+char *
+eel_gconf_get_string (const char *key)
+{
+ char *result;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, NULL);
+
+ result = gconf_client_get_string (client, key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ result = g_strdup ("");
+ }
+
+ return result;
+}
+
+void
+eel_gconf_set_string_list (const char *key,
+ const GSList *slist)
+{
+ GConfClient *client;
+ GError *error;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ error = NULL;
+ gconf_client_set_list (client, key, GCONF_VALUE_STRING,
+ /* Need cast cause of GConf api bug */
+ (GSList *) slist,
+ &error);
+ eel_gconf_handle_error (&error);
+}
+
+GSList *
+eel_gconf_get_string_list (const char *key)
+{
+ GSList *slist;
+ GConfClient *client;
+ GError *error;
+
+ g_return_val_if_fail (key != NULL, NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, NULL);
+
+ error = NULL;
+ slist = gconf_client_get_list (client, key, GCONF_VALUE_STRING, &error);
+ if (eel_gconf_handle_error (&error)) {
+ slist = NULL;
+ }
+
+ return slist;
+}
+
+/* This code wasn't part of the original eel-gconf-extensions.c */
+void
+eel_gconf_set_integer_list (const char *key,
+ const GSList *slist)
+{
+ GConfClient *client;
+ GError *error;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ error = NULL;
+ gconf_client_set_list (client, key, GCONF_VALUE_INT,
+ /* Need cast cause of GConf api bug */
+ (GSList *) slist,
+ &error);
+ eel_gconf_handle_error (&error);
+}
+
+GSList *
+eel_gconf_get_integer_list (const char *key)
+{
+ GSList *slist;
+ GConfClient *client;
+ GError *error;
+
+ g_return_val_if_fail (key != NULL, NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, NULL);
+
+ error = NULL;
+ slist = gconf_client_get_list (client, key, GCONF_VALUE_INT, &error);
+ if (eel_gconf_handle_error (&error)) {
+ slist = NULL;
+ }
+
+ return slist;
+}
+/* End of added code */
+
+gboolean
+eel_gconf_is_default (const char *key)
+{
+ gboolean result;
+ GConfValue *value;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ value = gconf_client_get_without_default (eel_gconf_client_get_global (), key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ if (value != NULL) {
+ gconf_value_free (value);
+ }
+ return FALSE;
+ }
+
+ result = (value == NULL);
+
+ if (value != NULL) {
+ gconf_value_free (value);
+ }
+
+
+ return result;
+}
+
+gboolean
+eel_gconf_monitor_add (const char *directory)
+{
+ GError *error = NULL;
+ GConfClient *client;
+
+ g_return_val_if_fail (directory != NULL, FALSE);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, FALSE);
+
+ gconf_client_add_dir (client,
+ directory,
+ GCONF_CLIENT_PRELOAD_NONE,
+ &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+eel_gconf_monitor_remove (const char *directory)
+{
+ GError *error = NULL;
+ GConfClient *client;
+
+ if (directory == NULL) {
+ return FALSE;
+ }
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, FALSE);
+
+ gconf_client_remove_dir (client,
+ directory,
+ &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void
+eel_gconf_suggest_sync (void)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_suggest_sync (client, &error);
+ eel_gconf_handle_error (&error);
+}
+
+GConfValue*
+eel_gconf_get_value (const char *key)
+{
+ GConfValue *value = NULL;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, NULL);
+
+ value = gconf_client_get (client, key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ if (value != NULL) {
+ gconf_value_free (value);
+ value = NULL;
+ }
+ }
+
+ return value;
+}
+
+void
+eel_gconf_set_value (const char *key, GConfValue *value)
+{
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_set (client, key, value, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ return;
+ }
+}
+
+void
+eel_gconf_value_free (GConfValue *value)
+{
+ if (value == NULL) {
+ return;
+ }
+
+ gconf_value_free (value);
+}
+
+guint
+eel_gconf_notification_add (const char *key,
+ GConfClientNotifyFunc notification_callback,
+ gpointer callback_data)
+{
+ guint notification_id;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, EEL_GCONF_UNDEFINED_CONNECTION);
+ g_return_val_if_fail (notification_callback != NULL, EEL_GCONF_UNDEFINED_CONNECTION);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, EEL_GCONF_UNDEFINED_CONNECTION);
+
+ notification_id = gconf_client_notify_add (client,
+ key,
+ notification_callback,
+ callback_data,
+ NULL,
+ &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ if (notification_id != EEL_GCONF_UNDEFINED_CONNECTION) {
+ gconf_client_notify_remove (client, notification_id);
+ notification_id = EEL_GCONF_UNDEFINED_CONNECTION;
+ }
+ }
+
+ return notification_id;
+}
+
+void
+eel_gconf_notification_remove (guint notification_id)
+{
+ GConfClient *client;
+
+ if (notification_id == EEL_GCONF_UNDEFINED_CONNECTION) {
+ return;
+ }
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_notify_remove (client, notification_id);
+}
+
+/* Simple wrapper for eel_gconf_notifier_add which
+ * adds the notifier id to the GList given as argument
+ * so that a call to ephy_notification_free can remove the notifiers
+ */
+void
+ephy_notification_add (const char *key,
+ GConfClientNotifyFunc notification_callback,
+ gpointer callback_data,
+ GList **notifiers)
+{
+ guint id = 0;
+
+ id = eel_gconf_notification_add(key,
+ notification_callback,
+ callback_data);
+ if (notifiers != NULL) {
+ *notifiers = g_list_append(*notifiers,
+ (gpointer)id);
+ }
+}
+
+/* Removes all the notifiers listed in notifiers */
+/* Frees the notifiers list */
+void
+ephy_notification_remove (GList **notifiers)
+{
+ g_list_foreach(*notifiers,
+ (GFunc)eel_gconf_notification_remove,
+ NULL);
+ g_list_free(*notifiers);
+ *notifiers = NULL;
+}
+
diff --git a/lib/eel-gconf-extensions.h b/lib/eel-gconf-extensions.h
new file mode 100644
index 000000000..df51afaa1
--- /dev/null
+++ b/lib/eel-gconf-extensions.h
@@ -0,0 +1,87 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* eel-gconf-extensions.h - Stuff to make GConf easier to use.
+
+ Copyright (C) 2000, 2001 Eazel, Inc.
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Authors: Ramiro Estrugo <ramiro@eazel.com>
+*/
+
+#ifndef EEL_GCONF_EXTENSIONS_H
+#define EEL_GCONF_EXTENSIONS_H
+
+#include <glib/gerror.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define EEL_GCONF_UNDEFINED_CONNECTION 0
+
+GConfClient *eel_gconf_client_get_global (void);
+gboolean eel_gconf_handle_error (GError **error);
+void eel_gconf_set_boolean (const char *key,
+ gboolean boolean_value);
+gboolean eel_gconf_get_boolean (const char *key);
+int eel_gconf_get_integer (const char *key);
+void eel_gconf_set_integer (const char *key,
+ int int_value);
+gfloat eel_gconf_get_float (const char *key);
+void eel_gconf_set_float (const char *key,
+ gfloat float_value);
+char * eel_gconf_get_string (const char *key);
+void eel_gconf_set_string (const char *key,
+ const char *string_value);
+GSList * eel_gconf_get_string_list (const char *key);
+void eel_gconf_set_string_list (const char *key,
+ const GSList *string_list_value);
+gboolean eel_gconf_is_default (const char *key);
+gboolean eel_gconf_monitor_add (const char *directory);
+gboolean eel_gconf_monitor_remove (const char *directory);
+void eel_gconf_suggest_sync (void);
+GConfValue* eel_gconf_get_value (const char *key);
+gboolean eel_gconf_value_is_equal (const GConfValue *a,
+ const GConfValue *b);
+void eel_gconf_set_value (const char *key, GConfValue *value);
+void eel_gconf_value_free (GConfValue *value);
+void eel_gconf_unset (const char *key);
+
+/* Functions which weren't part of the eel-gconf-extensions.h file from eel */
+GSList *eel_gconf_get_integer_list (const char *key);
+void eel_gconf_set_integer_list (const char *key,
+ const GSList *slist);
+guint eel_gconf_notification_add (const char *key,
+ GConfClientNotifyFunc notification_callback,
+ gpointer callback_data);
+void eel_gconf_notification_remove (guint notification_id);
+
+void ephy_notification_add (const char *key,
+ GConfClientNotifyFunc notification_callback,
+ gpointer callback_data,
+ GList **notifiers);
+
+void ephy_notification_remove (GList **notifiers);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EEL_GCONF_EXTENSIONS_H */
diff --git a/lib/ephy-autocompletion-source.c b/lib/ephy-autocompletion-source.c
new file mode 100644
index 000000000..717b9924e
--- /dev/null
+++ b/lib/ephy-autocompletion-source.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernándezs Pascual <ric@users.sourceforge.net>
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-autocompletion-source.h"
+#include "ephy-marshal.h"
+
+static void ephy_autocompletion_source_base_init (gpointer g_class);
+
+GType
+ephy_autocompletion_source_get_type (void)
+{
+ static GType autocompletion_source_type = 0;
+
+ if (! autocompletion_source_type)
+ {
+ static const GTypeInfo autocompletion_source_info =
+ {
+ sizeof (EphyAutocompletionSourceIface), /* class_size */
+ ephy_autocompletion_source_base_init, /* base_init */
+ NULL, /* base_finalize */
+ NULL,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ 0,
+ 0, /* n_preallocs */
+ NULL
+ };
+
+ autocompletion_source_type = g_type_register_static
+ (G_TYPE_INTERFACE, "EphyAutocompletionSource", &autocompletion_source_info, 0);
+ g_type_interface_add_prerequisite (autocompletion_source_type, G_TYPE_OBJECT);
+ }
+
+ return autocompletion_source_type;
+}
+
+static void
+ephy_autocompletion_source_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized)
+ {
+ g_signal_new ("data-changed",
+ EPHY_TYPE_AUTOCOMPLETION_SOURCE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyAutocompletionSourceIface, data_changed),
+ NULL, NULL,
+ ephy_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ initialized = TRUE;
+ }
+}
+
+
+void
+ephy_autocompletion_source_foreach (EphyAutocompletionSource *source,
+ const gchar *basic_key,
+ EphyAutocompletionSourceForeachFunc func,
+ gpointer data)
+{
+ (* EPHY_AUTOCOMPLETION_SOURCE_GET_IFACE (source)->foreach) (source, basic_key, func, data);
+}
+
+void
+ephy_autocompletion_source_set_basic_key (EphyAutocompletionSource *source,
+ const gchar *basic_key)
+{
+ (* EPHY_AUTOCOMPLETION_SOURCE_GET_IFACE (source)->set_basic_key) (source, basic_key);
+}
diff --git a/lib/ephy-autocompletion-source.h b/lib/ephy-autocompletion-source.h
new file mode 100644
index 000000000..595708b3a
--- /dev/null
+++ b/lib/ephy-autocompletion-source.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernándezs Pascual <ric@users.sourceforge.net>
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_AUTOCOMPLETION_SOUCE_H
+#define EPHY_AUTOCOMPLETION_SOUCE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_AUTOCOMPLETION_SOURCE (ephy_autocompletion_source_get_type ())
+#define EPHY_AUTOCOMPLETION_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ EPHY_TYPE_AUTOCOMPLETION_SOURCE, \
+ EphyAutocompletionSource))
+#define EPHY_IS_AUTOCOMPLETION_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ EPHY_TYPE_AUTOCOMPLETION_SOURCE))
+#define EPHY_AUTOCOMPLETION_SOURCE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \
+ EPHY_TYPE_AUTOCOMPLETION_SOURCE, \
+ EphyAutocompletionSourceIface))
+
+
+typedef struct _EphyAutocompletionSource EphyAutocompletionSource;
+typedef struct _EphyAutocompletionSourceIface EphyAutocompletionSourceIface;
+typedef void (* EphyAutocompletionSourceForeachFunc) (EphyAutocompletionSource *source,
+ const char *item,
+ const char *title,
+ const char *target,
+ gboolean is_action,
+ gboolean substring,
+ guint32 score,
+ gpointer data);
+
+struct _EphyAutocompletionSourceIface
+{
+ GTypeInterface g_iface;
+
+ /* Signals */
+
+ /**
+ * Sources MUST emit this signal when theirs data changes, expecially if the
+ * strings are freed / modified. Otherwise, things will crash.
+ */
+ void (* data_changed) (EphyAutocompletionSource *source);
+
+ /* Virtual Table */
+ void (* foreach) (EphyAutocompletionSource *source,
+ const gchar *basic_key,
+ EphyAutocompletionSourceForeachFunc func,
+ gpointer data);
+ void (* set_basic_key) (EphyAutocompletionSource *source,
+ const gchar *basic_key);
+};
+
+GType ephy_autocompletion_source_get_type (void);
+void ephy_autocompletion_source_foreach (EphyAutocompletionSource *source,
+ const gchar *basic_key,
+ EphyAutocompletionSourceForeachFunc func,
+ gpointer data);
+void ephy_autocompletion_source_set_basic_key (EphyAutocompletionSource *source,
+ const gchar *basic_key);
+
+G_END_DECLS
+
+#endif
+
diff --git a/lib/ephy-autocompletion.c b/lib/ephy-autocompletion.c
new file mode 100644
index 000000000..a3f3348c1
--- /dev/null
+++ b/lib/ephy-autocompletion.c
@@ -0,0 +1,664 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernández Pascual
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "ephy-autocompletion.h"
+#include "ephy-gobject-misc.h"
+#include "ephy-marshal.h"
+
+#define NOT_IMPLEMENTED g_warning ("not implemented: " G_STRLOC);
+
+//#define DEBUG_MSG(x) g_print x
+#define DEBUG_MSG(x)
+
+//#define DEBUG_TIME
+
+#ifdef DEBUG_TIME
+#include <glib/gtimer.h>
+#endif
+
+/**
+ * Private data
+ */
+
+typedef enum {
+ GAS_NEEDS_REFINE,
+ GAS_NEEDS_FULL_UPDATE,
+ GAS_UPDATED
+} EphyAutocompletionStatus;
+
+typedef struct {
+ EphyAutocompletionMatch *array;
+ guint num_matches;
+ guint num_action_matches;
+ guint array_size;
+} ACMatchArray;
+
+#define ACMA_BASE_SIZE 10240
+
+struct _EphyAutocompletionPrivate {
+ GSList *sources;
+
+ guint nkeys;
+ gchar **keys;
+ guint *key_lengths;
+ gchar **prefixes;
+ guint *prefix_lengths;
+
+ gchar *common_prefix;
+ ACMatchArray matches;
+ EphyAutocompletionStatus status;
+ gboolean sorted;
+ gboolean changed;
+
+ gboolean sort_alpha;
+};
+
+/**
+ * Private functions, only availble from this file
+ */
+static void ephy_autocompletion_class_init (EphyAutocompletionClass *klass);
+static void ephy_autocompletion_init (EphyAutocompletion *e);
+static void ephy_autocompletion_finalize_impl (GObject *o);
+static void ephy_autocompletion_reset (EphyAutocompletion *ac);
+static void ephy_autocompletion_update_matches (EphyAutocompletion *ac);
+static void ephy_autocompletion_update_matches_full (EphyAutocompletion *ac);
+static gboolean ephy_autocompletion_sort_by_score (EphyAutocompletion *ac);
+static void ephy_autocompletion_data_changed_cb (EphyAutocompletionSource *s,
+ EphyAutocompletion *ac);
+
+static void acma_init (ACMatchArray *a);
+static void acma_destroy (ACMatchArray *a);
+static inline void acma_append (ACMatchArray *a,
+ EphyAutocompletionMatch *m,
+ gboolean action);
+static void acma_grow (ACMatchArray *a);
+
+
+static gpointer g_object_class;
+
+/**
+ * Signals enums and ids
+ */
+enum EphyAutocompletionSignalsEnum {
+ EPHY_AUTOCOMPLETION_SOURCES_CHANGED,
+ EPHY_AUTOCOMPLETION_LAST_SIGNAL
+};
+static gint EphyAutocompletionSignals[EPHY_AUTOCOMPLETION_LAST_SIGNAL];
+
+/**
+ * Autocompletion object
+ */
+
+MAKE_GET_TYPE (ephy_autocompletion, "EphyAutocompletion", EphyAutocompletion,
+ ephy_autocompletion_class_init, ephy_autocompletion_init, G_TYPE_OBJECT);
+
+static void
+ephy_autocompletion_class_init (EphyAutocompletionClass *klass)
+{
+ G_OBJECT_CLASS (klass)->finalize = ephy_autocompletion_finalize_impl;
+ g_object_class = g_type_class_peek_parent (klass);
+
+ EphyAutocompletionSignals[EPHY_AUTOCOMPLETION_SOURCES_CHANGED] = g_signal_new (
+ "sources-changed", G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP,
+ G_STRUCT_OFFSET (EphyAutocompletionClass, sources_changed),
+ NULL, NULL,
+ ephy_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+ephy_autocompletion_init (EphyAutocompletion *ac)
+{
+ EphyAutocompletionPrivate *p = g_new0 (EphyAutocompletionPrivate, 1);
+ ac->priv = p;
+ p->sources = NULL;
+ p->common_prefix = NULL;
+ acma_init (&p->matches);
+ p->status = GAS_NEEDS_FULL_UPDATE;
+
+ p->nkeys = 1;
+
+ p->keys = g_new0 (gchar *, 2);
+ p->keys[0] = g_strdup ("");
+ p->key_lengths = g_new0 (guint, 2);
+ p->key_lengths[0] = 0;
+
+ p->prefixes = g_new0 (gchar *, 2);
+ p->prefixes[0] = g_strdup ("");
+ p->prefix_lengths = g_new0 (guint, 2);
+ p->prefix_lengths[0] = 0;
+
+ p->sort_alpha = TRUE;
+}
+
+static void
+ephy_autocompletion_finalize_impl (GObject *o)
+{
+ EphyAutocompletion *ac = EPHY_AUTOCOMPLETION (o);
+ EphyAutocompletionPrivate *p = ac->priv;
+ GSList *li;
+
+ ephy_autocompletion_reset (ac);
+
+ for (li = p->sources; li; li = li->next)
+ {
+ g_signal_handlers_disconnect_by_func (li->data,
+ ephy_autocompletion_data_changed_cb, ac);
+ g_object_unref (li->data);
+ }
+
+ g_slist_free (p->sources);
+
+ g_strfreev (p->keys);
+ g_free (p->key_lengths);
+ g_strfreev (p->prefixes);
+ g_free (p->prefix_lengths);
+
+ G_OBJECT_CLASS (g_object_class)->finalize (o);
+
+}
+
+static void
+ephy_autocompletion_reset (EphyAutocompletion *ac)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+#ifdef DEBUG_TIME
+ GTimer *timer = g_timer_new ();
+ g_timer_start (timer);
+#endif
+ acma_destroy (&p->matches);
+ g_free (p->common_prefix);
+ p->common_prefix = NULL;
+ p->status = GAS_NEEDS_FULL_UPDATE;
+#ifdef DEBUG_TIME
+ DEBUG_MSG (("AC: %f elapsed resetting\n", g_timer_elapsed (timer, NULL)));
+ g_timer_destroy (timer);
+#endif
+}
+
+EphyAutocompletion *
+ephy_autocompletion_new (void)
+{
+ EphyAutocompletion *ret = g_object_new (EPHY_TYPE_AUTOCOMPLETION, NULL);
+ return ret;
+}
+void
+ephy_autocompletion_add_source (EphyAutocompletion *ac,
+ EphyAutocompletionSource *s)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+ g_object_ref (G_OBJECT (s));
+ p->sources = g_slist_prepend (p->sources, s);
+ ephy_autocompletion_reset (ac);
+ g_signal_connect (s, "data-changed", G_CALLBACK (ephy_autocompletion_data_changed_cb), ac);
+
+ g_signal_emit (ac, EphyAutocompletionSignals[EPHY_AUTOCOMPLETION_SOURCES_CHANGED], 0);
+}
+
+void
+ephy_autocompletion_set_key (EphyAutocompletion *ac,
+ const gchar *key)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+ guint i;
+ guint keylen = strlen (key);
+
+ if (strcmp (key, p->keys[0]))
+ {
+ GSList *li;
+ for (li = p->sources; li; li = li->next)
+ {
+ ephy_autocompletion_source_set_basic_key
+ (EPHY_AUTOCOMPLETION_SOURCE (li->data), key);
+ }
+ }
+
+ if (keylen >= p->key_lengths[0]
+ && !strncmp (p->keys[0], key, p->key_lengths[0]))
+ {
+ if (!strcmp (key, p->keys[0]))
+ {
+ return;
+ }
+ if (p->status != GAS_NEEDS_FULL_UPDATE)
+ {
+ p->status = GAS_NEEDS_REFINE;
+ }
+ if (p->common_prefix)
+ {
+ if (strncmp (p->common_prefix, key, keylen))
+ {
+ g_free (p->common_prefix);
+ p->common_prefix = NULL;
+ }
+ }
+ }
+ else
+ {
+ p->status = GAS_NEEDS_FULL_UPDATE;
+ g_free (p->common_prefix);
+ p->common_prefix = NULL;
+ }
+
+ for (i = 0; p->prefixes[i]; ++i)
+ {
+ g_free (p->keys[i]);
+ p->keys[i] = g_strconcat (p->prefixes[i], key, NULL);
+ p->key_lengths[i] = keylen + p->prefix_lengths[i];
+ }
+
+}
+
+gchar *
+ephy_autocompletion_get_common_prefix (EphyAutocompletion *ac)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+ ephy_autocompletion_update_matches (ac);
+ if (!p->common_prefix)
+ {
+ guint common_length = 0;
+ guint i;
+#ifdef DEBUG_TIME
+ GTimer *timer = g_timer_new ();
+ g_timer_start (timer);
+#endif
+ for (i = 0; i < p->matches.num_matches; i++)
+ {
+ EphyAutocompletionMatch *mi = &p->matches.array[i];
+ const gchar *realmatch = mi->title + mi->offset;
+ if (!p->common_prefix)
+ {
+ p->common_prefix = g_strdup (realmatch);
+ common_length = strlen (p->common_prefix);
+ continue;
+ }
+ else if (!strncmp (realmatch, p->common_prefix, common_length))
+ {
+ continue;
+ }
+ else
+ {
+ common_length = 0;
+ while (realmatch[common_length]
+ && realmatch[common_length] == p->common_prefix[common_length])
+ {
+ ++common_length;
+ }
+ g_free (p->common_prefix);
+ p->common_prefix = g_strndup (realmatch, common_length);
+ }
+ }
+#ifdef DEBUG_TIME
+ DEBUG_MSG (("AC: %f elapsed calculating common prefix\n", g_timer_elapsed (timer, NULL)));
+ g_timer_destroy (timer);
+#endif
+ }
+ return g_strdup (p->common_prefix);
+}
+
+const EphyAutocompletionMatch *
+ephy_autocompletion_get_matches (EphyAutocompletion *ac)
+{
+ ephy_autocompletion_update_matches (ac);
+ return ac->priv->matches.array;
+}
+
+const EphyAutocompletionMatch *
+ephy_autocompletion_get_matches_sorted_by_score (EphyAutocompletion *ac,
+ gboolean *changed)
+{
+ *changed = ephy_autocompletion_sort_by_score (ac);
+ return ac->priv->matches.array;
+}
+
+guint
+ephy_autocompletion_get_num_matches (EphyAutocompletion *ac)
+{
+ ephy_autocompletion_update_matches (ac);
+
+ return ac->priv->matches.num_matches;
+}
+
+guint
+ephy_autocompletion_get_num_action_matches (EphyAutocompletion *ac)
+{
+ return ac->priv->matches.num_matches -
+ ac->priv->matches.num_action_matches;
+}
+
+static void
+ephy_autocompletion_refine_matches (EphyAutocompletion *ac)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+ ACMatchArray oldmatches = p->matches;
+ ACMatchArray newmatches;
+ guint i;
+ gchar *key0 = p->keys[0];
+ guint key0l = p->key_lengths[0];
+#ifdef DEBUG_TIME
+ GTimer *timer = g_timer_new ();
+#endif
+ DEBUG_MSG (("AC: refining\n"));
+
+#ifdef DEBUG_TIME
+ g_timer_start (timer);
+#endif
+ acma_init (&newmatches);
+
+ p->changed = FALSE;
+
+ for (i = 0; i < oldmatches.num_matches; i++)
+ {
+ EphyAutocompletionMatch *mi = &oldmatches.array[i];
+ if (mi->is_action ||
+ (mi->substring && g_strrstr (mi->match, p->keys[0])) ||
+ !strncmp (key0, mi->title + mi->offset, key0l))
+ {
+ acma_append (&newmatches, mi, mi->is_action);
+ }
+ else
+ {
+ p->changed = TRUE;
+ }
+ }
+
+ acma_destroy (&oldmatches);
+ p->matches = newmatches;
+
+#ifdef DEBUG_TIME
+ DEBUG_MSG (("AC: %f elapsed refining\n", g_timer_elapsed (timer, NULL)));
+ g_timer_destroy (timer);
+#endif
+ DEBUG_MSG (("AC: %d matches\n", p->matches.num_matches));
+}
+
+static void
+ephy_autocompletion_update_matches (EphyAutocompletion *ac)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+ if (p->status == GAS_UPDATED)
+ {
+ return;
+ }
+ if (p->status == GAS_NEEDS_FULL_UPDATE)
+ {
+ ephy_autocompletion_update_matches_full (ac);
+ }
+ if (p->status == GAS_NEEDS_REFINE)
+ {
+ /* FIXME we do full update for now */
+ ephy_autocompletion_refine_matches (ac);
+ }
+
+ g_free (p->common_prefix);
+ p->common_prefix = NULL;
+ p->status = GAS_UPDATED;
+}
+
+static void
+ephy_autocompletion_update_matches_full_item (EphyAutocompletionSource *source,
+ const char *item,
+ const char *title,
+ const char *target,
+ gboolean is_action,
+ gboolean substring,
+ guint32 score,
+ EphyAutocompletionPrivate *p)
+{
+ if (is_action ||
+ (substring && g_strrstr (item, p->keys[0])))
+ {
+ EphyAutocompletionMatch m;
+ m.match = item;
+ m.title = title;
+ m.target = target;
+ m.is_action = is_action;
+ m.substring = substring;
+ m.offset = 0;
+ m.score = score;
+ acma_append (&p->matches, &m, is_action);
+ }
+ else
+ {
+ guint i;
+ for (i = 0; p->keys[i]; ++i)
+ {
+ if (!strncmp (item, p->keys[i], p->key_lengths[i]))
+ {
+ EphyAutocompletionMatch m;
+ m.match = item;
+ m.title = title;
+ m.target = target;
+ m.is_action = is_action;
+ m.substring = substring;
+ m.offset = p->prefix_lengths[i];
+ m.score = score;
+ acma_append (&p->matches, &m, is_action);
+ }
+ }
+ }
+}
+
+static void
+ephy_autocompletion_update_matches_full (EphyAutocompletion *ac)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+ GSList *li;
+#ifdef DEBUG_TIME
+ GTimer *timer = g_timer_new ();
+#endif
+
+ DEBUG_MSG (("AC: fully updating\n"));
+ ephy_autocompletion_reset (ac);
+
+#ifdef DEBUG_TIME
+ g_timer_start (timer);
+#endif
+ for (li = p->sources; li; li = li->next)
+ {
+ EphyAutocompletionSource *s = EPHY_AUTOCOMPLETION_SOURCE (li->data);
+ g_assert (s);
+ ephy_autocompletion_source_foreach (s, p->keys[0],
+ (EphyAutocompletionSourceForeachFunc)
+ ephy_autocompletion_update_matches_full_item,
+ p);
+ }
+#ifdef DEBUG_TIME
+ DEBUG_MSG (("AC: %f elapsed fully updating\n", g_timer_elapsed (timer, NULL)));
+ g_timer_destroy (timer);
+#endif
+
+ p->sorted = FALSE;
+ p->changed = TRUE;
+
+ DEBUG_MSG (("AC: %d matches, fully updated\n", p->matches.num_matches));
+}
+
+static gint
+ephy_autocompletion_compare_scores (EphyAutocompletionMatch *a, EphyAutocompletionMatch *b)
+{
+ /* higher scores first */
+ return b->score - a->score;
+}
+
+static gint
+ephy_autocompletion_compare_scores_and_alpha (EphyAutocompletionMatch *a, EphyAutocompletionMatch *b)
+{
+ if (a->score == b->score)
+ {
+ return strcmp (a->title, b->title);
+ }
+ else
+ {
+ /* higher scores first */
+ return b->score - a->score;
+ }
+}
+
+static gboolean
+ephy_autocompletion_sort_by_score (EphyAutocompletion *ac)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+#ifdef DEBUG_TIME
+ GTimer *timer;
+#endif
+ gint (*comparer) (EphyAutocompletionMatch *m1, EphyAutocompletionMatch *m2);
+
+ if (p->sort_alpha)
+ {
+ comparer = ephy_autocompletion_compare_scores_and_alpha;
+ }
+ else
+ {
+ comparer = ephy_autocompletion_compare_scores;
+ }
+
+ ephy_autocompletion_update_matches (ac);
+ if (p->changed == FALSE) return FALSE;
+
+ DEBUG_MSG (("AC: sorting\n"));
+#ifdef DEBUG_TIME
+ timer = g_timer_new ();
+ g_timer_start (timer);
+#endif
+ if (p->matches.num_matches > 0)
+ {
+ qsort (p->matches.array, p->matches.num_matches,
+ sizeof (EphyAutocompletionMatch),
+ (void *) comparer);
+ }
+
+ p->sorted = TRUE;
+
+#ifdef DEBUG_TIME
+ DEBUG_MSG (("AC: %f elapsed sorting by score\n", g_timer_elapsed (timer, NULL)));
+ g_timer_destroy (timer);
+#endif
+ return TRUE;
+}
+
+static void
+ephy_autocompletion_data_changed_cb (EphyAutocompletionSource *s,
+ EphyAutocompletion *ac)
+{
+ DEBUG_MSG (("AC: data changed, reseting\n"));
+ ephy_autocompletion_reset (ac);
+
+ g_signal_emit (ac, EphyAutocompletionSignals[EPHY_AUTOCOMPLETION_SOURCES_CHANGED], 0);
+}
+
+void
+ephy_autocompletion_set_prefixes (EphyAutocompletion *ac,
+ const gchar **prefixes)
+{
+ EphyAutocompletionPrivate *p = ac->priv;
+ guint nprefixes = 0;
+ gchar *oldkey = g_strdup (p->keys[0]);
+ guint i;
+
+ /* count prefixes */
+ while (prefixes[nprefixes])
+ {
+ ++nprefixes;
+ }
+
+ nprefixes--;
+
+ g_strfreev (p->keys);
+ g_free (p->key_lengths);
+ g_strfreev (p->prefixes);
+ g_free (p->prefix_lengths);
+
+ p->prefixes = g_new0 (gchar *, nprefixes + 2);
+ p->prefix_lengths = g_new0 (guint, nprefixes + 2);
+ p->keys = g_new0 (gchar *, nprefixes + 2);
+ p->key_lengths = g_new0 (guint, nprefixes + 2);
+
+ p->prefixes[0] = g_strdup ("");
+ p->prefix_lengths[0] = 0;
+ p->keys[0] = oldkey;
+ p->key_lengths[0] = strlen (p->keys[0]);
+
+ for (i = 0; i < nprefixes; ++i)
+ {
+ p->prefixes[i + 1] = g_strdup (prefixes[i]);
+ p->prefix_lengths[i + 1] = strlen (prefixes[i]);
+ p->keys[i + 1] = g_strconcat (p->prefixes[i + 1], p->keys[0], NULL);
+ p->key_lengths[i + 1] = p->prefix_lengths[i + 1] + p->key_lengths[0];
+ }
+
+ p->nkeys = nprefixes;
+}
+
+
+/* ACMatchArray */
+
+static void
+acma_init (ACMatchArray *a)
+{
+ a->array = NULL;
+ a->array_size = 0;
+ a->num_matches = 0;
+}
+
+/**
+ * Does not free the struct itself, only its contents
+ */
+static void
+acma_destroy (ACMatchArray *a)
+{
+ g_free (a->array);
+ a->array = NULL;
+ a->array_size = 0;
+ a->num_matches = 0;
+ a->num_action_matches = 0;
+}
+
+static inline void
+acma_append (ACMatchArray *a,
+ EphyAutocompletionMatch *m,
+ gboolean action)
+{
+ if (a->array_size == a->num_matches)
+ {
+ acma_grow (a);
+ }
+
+ a->array[a->num_matches] = *m;
+ a->num_matches++;
+ if (action) a->num_action_matches++;
+}
+
+static void
+acma_grow (ACMatchArray *a)
+{
+ gint new_size;
+ EphyAutocompletionMatch *new_array;
+
+ new_size = a->array_size + ACMA_BASE_SIZE;
+ new_array = g_renew (EphyAutocompletionMatch, a->array, new_size);
+
+ a->array_size = new_size;
+ a->array = new_array;
+}
+
+
diff --git a/lib/ephy-autocompletion.h b/lib/ephy-autocompletion.h
new file mode 100644
index 000000000..06dcc71dc
--- /dev/null
+++ b/lib/ephy-autocompletion.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernández Pascual
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_AUTOCOMPLETION_H
+#define EPHY_AUTOCOMPLETION_H
+
+#include <glib-object.h>
+#include "ephy-autocompletion-source.h"
+
+G_BEGIN_DECLS
+
+/* object forward declarations */
+
+typedef struct _EphyAutocompletion EphyAutocompletion;
+typedef struct _EphyAutocompletionClass EphyAutocompletionClass;
+typedef struct _EphyAutocompletionPrivate EphyAutocompletionPrivate;
+typedef struct _EphyAutocompletionMatch EphyAutocompletionMatch;
+
+/**
+ * EphyAutocompletion object
+ */
+
+#define EPHY_TYPE_AUTOCOMPLETION (ephy_autocompletion_get_type())
+#define EPHY_AUTOCOMPLETION(object) (G_TYPE_CHECK_INSTANCE_CAST((object), \
+ EPHY_TYPE_AUTOCOMPLETION,\
+ EphyAutocompletion))
+#define EPHY_AUTOCOMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
+ EPHY_TYPE_AUTOCOMPLETION,\
+ EphyAutocompletionClass))
+#define EPHY_IS_AUTOCOMPLETION(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), \
+ EPHY_TYPE_AUTOCOMPLETION))
+#define EPHY_IS_AUTOCOMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ EPHY_TYPE_AUTOCOMPLETION))
+#define EPHY_AUTOCOMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ EPHY_TYPE_AUTOCOMPLETION,\
+ EphyAutocompletionClass))
+
+struct _EphyAutocompletionClass
+{
+ GObjectClass parent_class;
+
+ /* signals */
+ void (*sources_changed) (EphyAutocompletion *ac);
+};
+
+/* Remember: fields are public read-only */
+struct _EphyAutocompletion
+{
+ GObject parent_object;
+
+ EphyAutocompletionPrivate *priv;
+};
+
+struct _EphyAutocompletionMatch
+{
+ const char *match;
+ const char *title;
+ const char *target;
+ guint offset;
+ gint32 score;
+ gboolean is_action;
+ gboolean substring;
+};
+
+/* this is a set of usual prefixes for web browsing */
+#define EPHY_AUTOCOMPLETION_USUAL_WEB_PREFIXES \
+ "http://www.", \
+ "http://", \
+ "https://www.", \
+ "https://", \
+ "file://", \
+ "www."
+
+GType ephy_autocompletion_get_type (void);
+EphyAutocompletion * ephy_autocompletion_new (void);
+void ephy_autocompletion_add_source (EphyAutocompletion *ac,
+ EphyAutocompletionSource *s);
+void ephy_autocompletion_set_prefixes (EphyAutocompletion *ac,
+ const gchar **prefixes);
+void ephy_autocompletion_set_key (EphyAutocompletion *ac,
+ const gchar *key);
+gchar * ephy_autocompletion_get_common_prefix (EphyAutocompletion *ac);
+const EphyAutocompletionMatch *ephy_autocompletion_get_matches (EphyAutocompletion *ac);
+const EphyAutocompletionMatch *ephy_autocompletion_get_matches_sorted_by_score
+ (EphyAutocompletion *ac,
+ gboolean *changed);
+guint ephy_autocompletion_get_num_matches (EphyAutocompletion *ac);
+guint ephy_autocompletion_get_num_action_matches (EphyAutocompletion *ac);
+
+G_END_DECLS
+
+#endif
diff --git a/lib/ephy-bonobo-extensions.c b/lib/ephy-bonobo-extensions.c
new file mode 100644
index 000000000..e40b377cd
--- /dev/null
+++ b/lib/ephy-bonobo-extensions.c
@@ -0,0 +1,679 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* gul-bonobo-extensions.c - implementation of new functions that conceptually
+ belong in bonobo. Perhaps some of these will be
+ actually rolled into bonobo someday.
+
+ This file is based on nautilus-bonobo-extensions.c from
+ libnautilus-private.
+
+ Copyright (C) 2000, 2001 Eazel, Inc.
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Authors: John Sullivan <sullivan@eazel.com>
+ Darin Adler <darin@bentspoon.com>
+*/
+
+#include <config.h>
+
+#include "ephy-bonobo-extensions.h"
+#include "ephy-string.h"
+#include <string.h>
+
+#include <bonobo/bonobo-ui-util.h>
+#include <gtk/gtkmain.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
+#include <bonobo/bonobo-control.h>
+
+typedef enum {
+ NUMBERED_MENU_ITEM_PLAIN,
+ NUMBERED_MENU_ITEM_TOGGLE,
+ NUMBERED_MENU_ITEM_RADIO
+} NumberedMenuItemType;
+
+void
+ephy_bonobo_set_accelerator (BonoboUIComponent *ui,
+ const char *path,
+ const char *accelerator)
+{
+ if (bonobo_ui_component_get_container (ui)) /* should not do this here... */
+ {
+ bonobo_ui_component_set_prop (ui, path, "accel", accelerator, NULL);
+ }
+}
+
+void
+ephy_bonobo_set_label (BonoboUIComponent *ui,
+ const char *path,
+ const char *label)
+{
+ if (bonobo_ui_component_get_container (ui)) /* should not do this here... */
+ {
+ bonobo_ui_component_set_prop (ui, path, "label", label, NULL);
+ }
+}
+
+void
+ephy_bonobo_set_tip (BonoboUIComponent *ui,
+ const char *path,
+ const char *tip)
+{
+ if (bonobo_ui_component_get_container (ui)) /* should not do this here... */
+ {
+ bonobo_ui_component_set_prop (ui, path, "tip", tip, NULL);
+ }
+}
+
+void
+ephy_bonobo_set_sensitive (BonoboUIComponent *ui,
+ const char *path,
+ gboolean sensitive)
+{
+ if (bonobo_ui_component_get_container (ui)) /* should not do this here... */
+ {
+ bonobo_ui_component_set_prop (ui, path, "sensitive", sensitive ? "1" : "0", NULL);
+ }
+}
+
+void
+ephy_bonobo_set_toggle_state (BonoboUIComponent *ui,
+ const char *path,
+ gboolean state)
+{
+ if (bonobo_ui_component_get_container (ui)) /* should not do this here... */
+ {
+ bonobo_ui_component_set_prop (ui, path, "state", state ? "1" : "0", NULL);
+ }
+}
+
+void
+ephy_bonobo_set_hidden (BonoboUIComponent *ui,
+ const char *path,
+ gboolean hidden)
+{
+ if (bonobo_ui_component_get_container (ui)) /* should not do this here... */
+ {
+ bonobo_ui_component_set_prop (ui, path, "hidden", hidden ? "1" : "0", NULL);
+ }
+}
+
+char *
+ephy_bonobo_get_label (BonoboUIComponent *ui,
+ const char *path)
+{
+ if (bonobo_ui_component_get_container (ui)) /* should not do this here... */
+ {
+ return bonobo_ui_component_get_prop (ui, path, "label", NULL);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+gboolean
+ephy_bonobo_get_hidden (BonoboUIComponent *ui,
+ const char *path)
+{
+ char *value;
+ gboolean hidden;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (ui), FALSE);
+ g_return_val_if_fail (path != NULL, FALSE);
+
+ CORBA_exception_init (&ev);
+ value = bonobo_ui_component_get_prop (ui, path, "hidden", &ev);
+ CORBA_exception_free (&ev);
+
+ if (value == NULL) {
+ /* No hidden attribute means not hidden. */
+ hidden = FALSE;
+ } else {
+ /* Anything other than "0" counts as TRUE */
+ hidden = strcmp (value, "0") != 0;
+ g_free (value);
+ }
+
+ return hidden;
+}
+
+static char *
+get_numbered_menu_item_name (guint index)
+{
+ return g_strdup_printf ("%u", index);
+}
+
+char *
+ephy_bonobo_get_numbered_menu_item_path (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index)
+{
+ char *item_name;
+ char *item_path;
+
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (ui), NULL);
+ g_return_val_if_fail (container_path != NULL, NULL);
+
+ item_name = get_numbered_menu_item_name (index);
+ item_path = g_strconcat (container_path, "/", item_name, NULL);
+ g_free (item_name);
+
+ return item_path;
+}
+
+char *
+ephy_bonobo_get_numbered_menu_item_command (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index)
+{
+ char *command_name;
+ char *path;
+
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (ui), NULL);
+ g_return_val_if_fail (container_path != NULL, NULL);
+
+ path = ephy_bonobo_get_numbered_menu_item_path (ui, container_path, index);
+ command_name = gnome_vfs_escape_string (path);
+ g_free (path);
+
+ return command_name;
+}
+
+guint
+ephy_bonobo_get_numbered_menu_item_index_from_command (const char *command)
+{
+ char *path;
+ char *index_string;
+ int index;
+ gboolean got_index;
+
+ path = gnome_vfs_unescape_string (command, NULL);
+ index_string = strrchr (path, '/');
+
+ if (index_string == NULL) {
+ got_index = FALSE;
+ } else {
+ got_index = ephy_str_to_int (index_string + 1, &index);
+ }
+ g_free (path);
+
+ g_return_val_if_fail (got_index, 0);
+
+ return index;
+}
+
+char *
+ephy_bonobo_get_numbered_menu_item_container_path_from_command (const char *command)
+{
+ char *path;
+ char *index_string;
+ char *container_path;
+
+ path = gnome_vfs_unescape_string (command, NULL);
+ index_string = strrchr (path, '/');
+
+ container_path = index_string == NULL
+ ? NULL
+ : g_strndup (path, index_string - path);
+ g_free (path);
+
+ return container_path;
+}
+
+static char *
+ephy_bonobo_add_numbered_menu_item_internal (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ NumberedMenuItemType type,
+ GdkPixbuf *pixbuf,
+ const char *radio_group_name)
+{
+ char *xml_item, *xml_command;
+ char *command_name;
+ char *item_name, *pixbuf_data;
+ char *path;
+
+ g_assert (BONOBO_IS_UI_COMPONENT (ui));
+ g_assert (container_path != NULL);
+ g_assert (label != NULL);
+ g_assert (type == NUMBERED_MENU_ITEM_PLAIN || pixbuf == NULL);
+ g_assert (type == NUMBERED_MENU_ITEM_RADIO || radio_group_name == NULL);
+ g_assert (type != NUMBERED_MENU_ITEM_RADIO || radio_group_name != NULL);
+
+ item_name = get_numbered_menu_item_name (index);
+ command_name = ephy_bonobo_get_numbered_menu_item_command
+ (ui, container_path, index);
+
+ switch (type) {
+ case NUMBERED_MENU_ITEM_TOGGLE:
+ xml_item = g_strdup_printf ("<menuitem name=\"%s\" id=\"%s\" type=\"toggle\"/>\n",
+ item_name, command_name);
+ break;
+ case NUMBERED_MENU_ITEM_RADIO:
+ xml_item = g_strdup_printf ("<menuitem name=\"%s\" id=\"%s\" "
+ "type=\"radio\" group=\"%s\"/>\n",
+ item_name, command_name, radio_group_name);
+ break;
+ case NUMBERED_MENU_ITEM_PLAIN:
+ if (pixbuf != NULL) {
+ pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
+ xml_item = g_strdup_printf ("<menuitem name=\"%s\" verb=\"%s\" "
+ "pixtype=\"pixbuf\" pixname=\"%s\"/>\n",
+ item_name, command_name, pixbuf_data);
+ g_free (pixbuf_data);
+ } else {
+ xml_item = g_strdup_printf ("<menuitem name=\"%s\" verb=\"%s\"/>\n",
+ item_name, command_name);
+ }
+ break;
+ default:
+ g_assert_not_reached ();
+ xml_item = NULL; /* keep compiler happy */
+ }
+
+ g_free (item_name);
+
+ bonobo_ui_component_set (ui, container_path, xml_item, NULL);
+
+ g_free (xml_item);
+
+ path = ephy_bonobo_get_numbered_menu_item_path (ui, container_path, index);
+ ephy_bonobo_set_label (ui, path, label);
+ g_free (path);
+
+ /* Make the command node here too, so callers can immediately set
+ * properties on it (otherwise it doesn't get created until some
+ * time later).
+ */
+ xml_command = g_strdup_printf ("<cmd name=\"%s\"/>\n", command_name);
+ bonobo_ui_component_set (ui, "/commands", xml_command, NULL);
+ g_free (xml_command);
+
+ g_free (command_name);
+
+ return item_name;
+}
+
+/* Add a menu item specified by number into a given path. Used for
+ * dynamically creating a related series of menu items. Each index
+ * must be unique (normal use is to call this in a loop, and
+ * increment the index for each item).
+ */
+void
+ephy_bonobo_add_numbered_menu_item (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ GdkPixbuf *pixbuf)
+{
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (container_path != NULL);
+ g_return_if_fail (label != NULL);
+
+ ephy_bonobo_add_numbered_menu_item_internal (ui, container_path, index, label,
+ NUMBERED_MENU_ITEM_PLAIN, pixbuf, NULL);
+}
+
+/* Add a menu item specified by number into a given path. Used for
+ * dynamically creating a related series of toggle menu items. Each index
+ * must be unique (normal use is to call this in a loop, and
+ * increment the index for each item).
+ */
+void
+ephy_bonobo_add_numbered_toggle_menu_item (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label)
+{
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (container_path != NULL);
+ g_return_if_fail (label != NULL);
+
+ ephy_bonobo_add_numbered_menu_item_internal (ui, container_path, index, label,
+ NUMBERED_MENU_ITEM_TOGGLE, NULL, NULL);
+}
+
+/* Add a menu item specified by number into a given path. Used for
+ * dynamically creating a related series of radio menu items. Each index
+ * must be unique (normal use is to call this in a loop, and
+ * increment the index for each item).
+ */
+void
+ephy_bonobo_add_numbered_radio_menu_item (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ const char *radio_group_name)
+{
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (container_path != NULL);
+ g_return_if_fail (label != NULL);
+
+ ephy_bonobo_add_numbered_menu_item_internal (ui, container_path, index, label,
+ NUMBERED_MENU_ITEM_RADIO, NULL, radio_group_name);
+}
+
+void
+ephy_bonobo_add_numbered_submenu (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ GdkPixbuf *pixbuf)
+{
+ char *xml_string, *item_name, *pixbuf_data, *submenu_path, *command_name;
+
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (container_path != NULL);
+ g_return_if_fail (label != NULL);
+ g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
+
+ item_name = get_numbered_menu_item_name (index);
+ command_name = ephy_bonobo_get_numbered_menu_item_command (ui, container_path, index);
+
+ if (pixbuf != NULL) {
+ pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
+ xml_string = g_strdup_printf ("<submenu name=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\" "
+ "verb=\"%s\"/>\n",
+ item_name, pixbuf_data, command_name);
+ g_free (pixbuf_data);
+ } else {
+ xml_string = g_strdup_printf ("<submenu name=\"%s\" verb=\"%s\"/>\n", item_name,
+ command_name);
+ }
+
+ bonobo_ui_component_set (ui, container_path, xml_string, NULL);
+
+ g_free (xml_string);
+
+ submenu_path = ephy_bonobo_get_numbered_menu_item_path (ui, container_path, index);
+ ephy_bonobo_set_label (ui, submenu_path, label);
+ g_free (submenu_path);
+
+ g_free (item_name);
+ g_free (command_name);
+}
+
+void
+ephy_bonobo_add_numbered_submenu_no_verb (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ GdkPixbuf *pixbuf)
+{
+ char *xml_string, *item_name, *pixbuf_data, *submenu_path;
+
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (container_path != NULL);
+ g_return_if_fail (label != NULL);
+ g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
+
+ item_name = get_numbered_menu_item_name (index);
+
+ if (pixbuf != NULL) {
+ pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
+ xml_string = g_strdup_printf ("<submenu name=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\" "
+ "/>\n",
+ item_name, pixbuf_data);
+ g_free (pixbuf_data);
+ } else {
+ xml_string = g_strdup_printf ("<submenu name=\"%s\"/>\n", item_name);
+ }
+
+ bonobo_ui_component_set (ui, container_path, xml_string, NULL);
+
+ g_free (xml_string);
+
+ submenu_path = ephy_bonobo_get_numbered_menu_item_path (ui, container_path, index);
+ ephy_bonobo_set_label (ui, submenu_path, label);
+ g_free (submenu_path);
+
+ g_free (item_name);
+}
+
+void
+ephy_bonobo_add_submenu (BonoboUIComponent *ui,
+ const char *path,
+ const char *label,
+ GdkPixbuf *pixbuf)
+{
+ char *xml_string, *name, *pixbuf_data, *submenu_path;
+
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (label != NULL);
+ g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
+
+ /* Labels may contain characters that are illegal in names. So
+ * we create the name by URI-encoding the label.
+ */
+ name = gnome_vfs_escape_string (label);
+
+ if (pixbuf != NULL) {
+ pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
+ xml_string = g_strdup_printf ("<submenu name=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\"/>\n",
+ name, pixbuf_data);
+ g_free (pixbuf_data);
+ } else {
+ xml_string = g_strdup_printf ("<submenu name=\"%s\"/>\n", name);
+ }
+
+ bonobo_ui_component_set (ui, path, xml_string, NULL);
+
+ g_free (xml_string);
+
+ submenu_path = g_strconcat (path, "/", name, NULL);
+ ephy_bonobo_set_label (ui, submenu_path, label);
+ g_free (submenu_path);
+
+ g_free (name);
+}
+
+void
+ephy_bonobo_add_menu_separator (BonoboUIComponent *ui, const char *path)
+{
+ static gint hack = 0;
+ gchar *xml;
+
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (path != NULL);
+
+ xml = g_strdup_printf ("<separator name=\"sep%d\"/>", ++hack);
+ bonobo_ui_component_set (ui, path, xml, NULL);
+ g_free (xml);
+}
+
+static void
+remove_commands (BonoboUIComponent *ui, const char *container_path)
+{
+ BonoboUINode *path_node;
+ BonoboUINode *child_node;
+ char *verb_name;
+ char *id_name;
+
+ path_node = bonobo_ui_component_get_tree (ui, container_path, TRUE, NULL);
+ if (path_node == NULL) {
+ return;
+ }
+
+ bonobo_ui_component_freeze (ui, NULL);
+
+ for (child_node = bonobo_ui_node_children (path_node);
+ child_node != NULL;
+ child_node = bonobo_ui_node_next (child_node)) {
+ verb_name = bonobo_ui_node_get_attr (child_node, "verb");
+ if (verb_name != NULL) {
+ bonobo_ui_component_remove_verb (ui, verb_name);
+ bonobo_ui_node_free_string (verb_name);
+ } else {
+ /* Only look for an id if there's no verb */
+ id_name = bonobo_ui_node_get_attr (child_node, "id");
+ if (id_name != NULL) {
+ bonobo_ui_component_remove_listener (ui, id_name);
+ bonobo_ui_node_free_string (id_name);
+ }
+ }
+ }
+
+ bonobo_ui_component_thaw (ui, NULL);
+
+ bonobo_ui_node_free (path_node);
+}
+
+/**
+ * ephy_bonobo_remove_menu_items_and_verbs
+ *
+ * Removes all menu items contained in a menu or placeholder, and
+ * their verbs.
+ *
+ * @uih: The BonoboUIHandler for this menu item.
+ * @container_path: The standard bonobo-style path specifier for this placeholder or submenu.
+ */
+void
+ephy_bonobo_remove_menu_items_and_commands (BonoboUIComponent *ui,
+ const char *container_path)
+{
+ char *remove_wildcard;
+
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (container_path != NULL);
+
+ remove_commands (ui, container_path);
+
+ /* For speed, remove menu items themselves all in one fell swoop,
+ * though we removed the verbs one-by-one.
+ */
+ remove_wildcard = g_strdup_printf ("%s/*", container_path);
+ bonobo_ui_component_rm (ui, remove_wildcard, NULL);
+ g_free (remove_wildcard);
+}
+
+/* Call to set the user-visible label of a menu item to a string
+ * containing an underscore accelerator. The underscore is stripped
+ * off before setting the label of the command, because pop-up menu
+ * and toolbar button labels shouldn't have the underscore.
+ */
+void
+ephy_bonobo_set_label_for_menu_item_and_command (BonoboUIComponent *ui,
+ const char *menu_item_path,
+ const char *command_path,
+ const char *label_with_underscore)
+{
+ char *label_no_underscore;
+
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
+ g_return_if_fail (menu_item_path != NULL);
+ g_return_if_fail (command_path != NULL);
+ g_return_if_fail (label_with_underscore != NULL);
+
+ label_no_underscore = ephy_str_strip_chr (label_with_underscore, '_');
+ ephy_bonobo_set_label (ui,
+ menu_item_path,
+ label_with_underscore);
+ ephy_bonobo_set_label (ui,
+ command_path,
+ label_no_underscore);
+
+ g_free (label_no_underscore);
+}
+
+gchar *
+ephy_bonobo_add_dockitem (BonoboUIComponent *uic,
+ const char *name,
+ int band_num)
+{
+ gchar *xml;
+ gchar *sname;
+ gchar *path;
+
+ sname = gnome_vfs_escape_string (name);
+ xml = g_strdup_printf ("<dockitem name=\"%s\" band_num=\"%d\" "
+ "config=\"0\" behavior=\"exclusive\"/>",
+ sname, band_num);
+ path = g_strdup_printf ("/%s", sname);
+ bonobo_ui_component_set (uic, "", xml, NULL);
+
+ g_free (sname);
+ g_free (xml);
+ return path;
+}
+
+BonoboControl *
+ephy_bonobo_add_numbered_control (BonoboUIComponent *uic, GtkWidget *w,
+ guint index, const char *container_path)
+{
+ BonoboControl *control;
+ char *xml_string, *item_name, *control_path;
+
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (uic), NULL);
+ g_return_val_if_fail (container_path != NULL, NULL);
+
+ item_name = get_numbered_menu_item_name (index);
+ xml_string = g_strdup_printf ("<control name=\"%s\"/>", item_name);
+
+ bonobo_ui_component_set (uic, container_path, xml_string, NULL);
+
+ g_free (xml_string);
+
+ control_path = ephy_bonobo_get_numbered_menu_item_path (uic, container_path, index);
+
+ control = bonobo_control_new (w);
+ bonobo_ui_component_object_set (uic, control_path, BONOBO_OBJREF (control), NULL);
+ bonobo_object_unref (control);
+
+ g_free (control_path);
+ g_free (item_name);
+
+ return control;
+}
+
+void
+ephy_bonobo_replace_path (BonoboUIComponent *uic, const gchar *path_src,
+ const char *path_dst)
+{
+ BonoboUINode *node;
+ const char *name;
+ char *path_dst_folder;
+
+ name = strrchr (path_dst, '/');
+ g_return_if_fail (name != NULL);
+ path_dst_folder = g_strndup (path_dst, name - path_dst);
+ name++;
+
+ node = bonobo_ui_component_get_tree (uic, path_src, TRUE, NULL);
+ bonobo_ui_node_set_attr (node, "name", name);
+
+ ephy_bonobo_clear_path (uic, path_dst);
+
+ bonobo_ui_component_set_tree (uic, path_dst_folder, node, NULL);
+
+ g_free (path_dst_folder);
+ bonobo_ui_node_free (node);
+}
+
+void
+ephy_bonobo_clear_path (BonoboUIComponent *uic,
+ const gchar *path)
+{
+ if (bonobo_ui_component_path_exists (uic, path, NULL))
+ {
+ char *remove_wildcard = g_strdup_printf ("%s/*", path);
+ bonobo_ui_component_rm (uic, remove_wildcard, NULL);
+ g_free (remove_wildcard);
+ }
+}
diff --git a/lib/ephy-bonobo-extensions.h b/lib/ephy-bonobo-extensions.h
new file mode 100644
index 000000000..86bb977f9
--- /dev/null
+++ b/lib/ephy-bonobo-extensions.h
@@ -0,0 +1,121 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* gul-bonobo-extensions.h - interface for new functions that conceptually
+ belong in bonobo. Perhaps some of these will be
+ actually rolled into bonobo someday.
+
+
+ This file is based on nautilus-bonobo-extensions.h from
+ libnautilus-private.
+
+
+ Copyright (C) 2000 Eazel, Inc.
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: John Sullivan <sullivan@eazel.com>
+*/
+
+#ifndef EPHY_BONOBO_EXTENSIONS_H
+#define EPHY_BONOBO_EXTENSIONS_H
+
+#include <bonobo/bonobo-ui-component.h>
+#include <bonobo/bonobo-control.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gtk/gtkwidget.h>
+
+void ephy_bonobo_set_accelerator (BonoboUIComponent *ui,
+ const char *path,
+ const char *accelerator);
+char *ephy_bonobo_get_label (BonoboUIComponent *ui,
+ const char *path);
+void ephy_bonobo_set_label (BonoboUIComponent *ui,
+ const char *path,
+ const char *label);
+void ephy_bonobo_set_tip (BonoboUIComponent *ui,
+ const char *path,
+ const char *tip);
+void ephy_bonobo_set_sensitive (BonoboUIComponent *ui,
+ const char *path,
+ gboolean sensitive);
+void ephy_bonobo_set_toggle_state (BonoboUIComponent *ui,
+ const char *path,
+ gboolean state);
+void ephy_bonobo_set_hidden (BonoboUIComponent *ui,
+ const char *path,
+ gboolean hidden);
+gboolean ephy_bonobo_get_hidden (BonoboUIComponent *ui,
+ const char *path);
+void ephy_bonobo_add_numbered_menu_item (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ GdkPixbuf *pixbuf);
+void ephy_bonobo_add_numbered_toggle_menu_item (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label);
+void ephy_bonobo_add_numbered_radio_menu_item (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ const char *radio_group_name);
+char *ephy_bonobo_get_numbered_menu_item_command (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index);
+char *ephy_bonobo_get_numbered_menu_item_path (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index);
+guint ephy_bonobo_get_numbered_menu_item_index_from_command (const char *command);
+char *ephy_bonobo_get_numbered_menu_item_container_path_from_command (const char *command);
+void ephy_bonobo_add_submenu (BonoboUIComponent *ui,
+ const char *container_path,
+ const char *label,
+ GdkPixbuf *pixbuf);
+void ephy_bonobo_add_numbered_submenu (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ GdkPixbuf *pixbuf);
+void ephy_bonobo_add_numbered_submenu_no_verb (BonoboUIComponent *ui,
+ const char *container_path,
+ guint index,
+ const char *label,
+ GdkPixbuf *pixbuf);
+void ephy_bonobo_add_menu_separator (BonoboUIComponent *ui,
+ const char *path);
+void ephy_bonobo_remove_menu_items_and_commands (BonoboUIComponent *ui,
+ const char *container_path);
+void ephy_bonobo_set_label_for_menu_item_and_command (BonoboUIComponent *ui,
+ const char *menu_item_path,
+ const char *command_path,
+ const char *label_with_underscore);
+void ephy_bonobo_set_icon (BonoboUIComponent *ui,
+ const char *path,
+ const char *icon_relative_path);
+gchar *ephy_bonobo_add_dockitem (BonoboUIComponent *uic,
+ const char *name,
+ int band_num);
+BonoboControl *ephy_bonobo_add_numbered_control (BonoboUIComponent *uic,
+ GtkWidget *w, guint index,
+ const char *path);
+void ephy_bonobo_clear_path (BonoboUIComponent *uic,
+ const gchar *path);
+void ephy_bonobo_replace_path (BonoboUIComponent *uic,
+ const gchar *path_src,
+ const char *path_dst);
+
+#endif /* EPHY_BONOBO_EXTENSIONS_H */
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
new file mode 100644
index 000000000..8c8344dda
--- /dev/null
+++ b/lib/ephy-dialog.c
@@ -0,0 +1,943 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-dialog.h"
+#include "ephy-glade.h"
+#include "ephy-state.h"
+#include "ephy-prefs-utils.h"
+#include "ephy-gui.h"
+
+#include <string.h>
+#include <gtk/gtktogglebutton.h>
+
+static void
+ephy_dialog_class_init (EphyDialogClass *klass);
+static void
+ephy_dialog_init (EphyDialog *window);
+static void
+ephy_dialog_finalize (GObject *object);
+static void
+ephy_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void
+ephy_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void
+ephy_dialog_set_parent (EphyDialog *dialog,
+ GtkWidget *parent);
+
+static void
+impl_construct (EphyDialog *dialog,
+ const EphyDialogProperty *properties,
+ const char *file,
+ const char *name);
+
+static void
+impl_destruct (EphyDialog *dialog);
+
+static GtkWidget *
+impl_get_control (EphyDialog *dialog,
+ int property_id);
+static void
+impl_get_value (EphyDialog *dialog,
+ int property_id,
+ GValue *value);
+static gint
+impl_run (EphyDialog *dialog);
+static void
+impl_show (EphyDialog *dialog);
+void
+ephy_dialog_destroy_cb (GtkWidget *widget,
+ EphyDialog *dialog);
+
+enum
+{
+ PROP_0,
+ PROP_PARENT_WINDOW,
+ PROP_MODAL
+};
+
+typedef enum
+{
+ PT_TOGGLEBUTTON,
+ PT_RADIOBUTTON,
+ PT_SPINBUTTON,
+ PT_COLOR,
+ PT_OPTIONMENU,
+ PT_ENTRY,
+ PT_UNKNOWN
+} PrefType;
+
+typedef struct
+{
+ int id;
+ GtkWidget *widget;
+ const char *pref;
+ int *sg;
+ PropertyType type;
+} PropertyInfo;
+
+struct EphyDialogPrivate
+{
+ GtkWidget *parent;
+ GtkWidget *dialog;
+ GtkWidget *container;
+ PropertyInfo *props;
+ gboolean modal;
+ char *name;
+
+ int spin_item_id;
+ GTimer *spin_timer;
+};
+
+#define SPIN_DELAY 0.20
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_dialog_get_type (void)
+{
+ static GType ephy_dialog_type = 0;
+
+ if (ephy_dialog_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyDialogClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_dialog_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (EphyDialog),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_dialog_init
+ };
+
+ ephy_dialog_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyDialog",
+ &our_info, 0);
+ }
+
+ return ephy_dialog_type;
+}
+
+static void
+ephy_dialog_class_init (EphyDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_dialog_finalize;
+ object_class->set_property = ephy_dialog_set_property;
+ object_class->get_property = ephy_dialog_get_property;
+
+ klass->construct = impl_construct;
+ klass->get_control = impl_get_control;
+ klass->get_value = impl_get_value;
+ klass->run = impl_run;
+ klass->show = impl_show;
+ klass->destruct = impl_destruct;
+
+ g_object_class_install_property (object_class,
+ PROP_PARENT_WINDOW,
+ g_param_spec_object ("ParentWindow",
+ "ParentWindow",
+ "Parent window",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_MODAL,
+ g_param_spec_boolean ("Modal",
+ "Modal",
+ "Modal dialog",
+ FALSE,
+ G_PARAM_READWRITE));
+}
+
+static PrefType
+get_pref_type_from_widget (GtkWidget *widget)
+{
+ if (GTK_IS_OPTION_MENU (widget))
+ {
+ return PT_OPTIONMENU;
+ }
+ else if (GTK_IS_SPIN_BUTTON (widget))
+ {
+ return PT_SPINBUTTON;
+ }
+ else if (GTK_IS_RADIO_BUTTON (widget))
+ {
+ return PT_RADIOBUTTON;
+ }
+ else if (GTK_IS_TOGGLE_BUTTON (widget))
+ {
+ return PT_TOGGLEBUTTON;
+ }
+ else if (GTK_IS_ENTRY (widget))
+ {
+ return PT_ENTRY;
+ }
+ else if (GNOME_IS_COLOR_PICKER (widget))
+ {
+ return PT_COLOR;
+ }
+
+ return PT_UNKNOWN;
+}
+
+static int *
+set_controls_sensitivity (EphyDialog *dialog,
+ int *sg, gboolean s)
+{
+ GtkWidget *widget;
+
+ while (*sg != SY_END_GROUP)
+ {
+ widget = ephy_dialog_get_control (dialog,
+ *sg);
+ gtk_widget_set_sensitive (widget, s);
+
+ sg++;
+ }
+
+ return sg;
+}
+
+static void
+prefs_set_group_sensitivity (GtkWidget *widget,
+ PrefType type, int *sg)
+{
+ int group = -1;
+ EphyDialog *dialog;
+ int i = 0;
+
+ if (sg == NULL) return;
+
+ dialog = EPHY_DIALOG (g_object_get_data
+ (G_OBJECT(widget), "dialog"));
+
+ if (GTK_IS_RADIO_BUTTON (widget))
+ {
+ group = ephy_gui_gtk_radio_button_get
+ (GTK_RADIO_BUTTON(widget));
+ }
+ else if (GTK_IS_TOGGLE_BUTTON (widget))
+ {
+ group = !gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(widget));
+ }
+ else
+ {
+ g_assert (FALSE);
+ }
+
+ while (*sg != SY_END)
+ {
+ if ((*sg == SY_BEGIN_GROUP) ||
+ (*sg == SY_BEGIN_GROUP_INVERSE))
+ {
+ gboolean b;
+
+ b = (i == group);
+ if (*sg == SY_BEGIN_GROUP_INVERSE) b = !b;
+
+ sg++;
+ sg = set_controls_sensitivity
+ (dialog, sg, b);
+ }
+
+ i++;
+ sg++;
+ }
+}
+
+static void
+prefs_togglebutton_clicked_cb (GtkWidget *widget, PropertyInfo *pi)
+{
+ if (pi->type == PT_AUTOAPPLY)
+ {
+ ephy_pu_set_config_from_togglebutton (widget, pi->pref);
+ }
+
+ prefs_set_group_sensitivity (widget, pi->type, pi->sg);
+}
+
+static void
+prefs_radiobutton_clicked_cb (GtkWidget *widget, PropertyInfo *pi)
+{
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)))
+ {
+ return;
+ }
+
+ if (pi->type == PT_AUTOAPPLY)
+ {
+ ephy_pu_set_config_from_radiobuttongroup (widget, pi->pref);
+ }
+
+ prefs_set_group_sensitivity (widget, pi->type, pi->sg);
+}
+
+static gint
+prefs_spinbutton_timeout_cb (EphyDialog *dialog)
+{
+ PropertyInfo pi = dialog->priv->props[dialog->priv->spin_item_id];
+
+ /* timer still valid? */
+ if (dialog->priv->spin_timer == NULL)
+ {
+ return FALSE;
+ }
+
+ /* okay, we're ready to set */
+ if (g_timer_elapsed (dialog->priv->spin_timer, NULL) >= SPIN_DELAY)
+ {
+ /* kill off the timer */
+ g_timer_destroy (dialog->priv->spin_timer);
+ dialog->priv->spin_timer = NULL;
+
+ /* HACK update the spinbutton here so that the
+ * changes made directly in the entry are accepted
+ * and set in the pref. Otherwise the old value is used */
+ gtk_spin_button_update (GTK_SPIN_BUTTON(pi.widget));
+
+ /* set */
+ ephy_pu_set_config_from_spin_button (pi.widget,
+ pi.pref);
+
+ /* done now */
+ return FALSE;
+ }
+
+ /* call me again */
+ return TRUE;
+}
+
+static void
+prefs_spinbutton_changed_cb (GtkWidget *widget, PropertyInfo *pi)
+{
+ EphyDialog *dialog;
+
+ if (pi->type != PT_AUTOAPPLY) return;
+
+ dialog = EPHY_DIALOG (g_object_get_data
+ (G_OBJECT(widget), "dialog"));
+
+ dialog->priv->spin_item_id = pi->id;
+
+ /* destroy any existing timer */
+ if (dialog->priv->spin_timer != NULL)
+ {
+ g_timer_destroy (dialog->priv->spin_timer);
+ }
+
+ /* start the new one */
+ dialog->priv->spin_timer = g_timer_new();
+ g_timer_start (dialog->priv->spin_timer);
+ g_timeout_add (50, (GSourceFunc) prefs_spinbutton_timeout_cb,
+ dialog);
+}
+
+static void
+prefs_color_changed_cb (GtkWidget *widget, guint r, guint g,
+ guint b, guint a, const PropertyInfo *pi)
+{
+ if (pi->type == PT_AUTOAPPLY)
+ {
+ ephy_pu_set_config_from_color (widget, pi->pref);
+ }
+}
+
+static void
+prefs_entry_changed_cb (GtkWidget *widget, PropertyInfo *pi)
+{
+ if (pi->type == PT_AUTOAPPLY)
+ {
+ ephy_pu_set_config_from_editable (widget, pi->pref);
+ }
+}
+
+static void
+prefs_optionmenu_selected_cb (GtkWidget *widget, PropertyInfo *pi)
+{
+ if (pi->type == PT_AUTOAPPLY)
+ {
+ ephy_pu_set_config_from_optionmenu (widget, pi->pref);
+ }
+}
+
+static void
+prefs_connect_signals (EphyDialog *dialog)
+{
+ int i;
+ GSList *list;
+ PropertyInfo *props = dialog->priv->props;
+
+ for (i = 0; props[i].widget != NULL; i++)
+ {
+ PrefType type;
+ PropertyInfo *info;
+
+ if ((props[i].type != PT_AUTOAPPLY) &&
+ (props[i].sg == NULL))
+ continue;
+
+ info = &dialog->priv->props[i];
+ type = get_pref_type_from_widget
+ (dialog->priv->props[i].widget);
+
+ switch (type)
+ {
+ case PT_TOGGLEBUTTON:
+ g_object_set_data (G_OBJECT(info->widget), "dialog", dialog);
+ g_signal_connect (G_OBJECT (info->widget), "clicked",
+ G_CALLBACK(prefs_togglebutton_clicked_cb),
+ (gpointer)info);
+ break;
+ case PT_RADIOBUTTON:
+ list = gtk_radio_button_get_group
+ (GTK_RADIO_BUTTON(info->widget));
+ for (; list != NULL; list = list->next)
+ {
+ g_object_set_data (G_OBJECT(list->data),
+ "dialog", dialog);
+ g_signal_connect
+ (G_OBJECT (list->data), "clicked",
+ G_CALLBACK(prefs_radiobutton_clicked_cb),
+ (gpointer)info);
+ }
+ break;
+ case PT_SPINBUTTON:
+ g_object_set_data (G_OBJECT(info->widget), "dialog", dialog);
+ g_signal_connect (G_OBJECT (info->widget), "changed",
+ G_CALLBACK(prefs_spinbutton_changed_cb),
+ (gpointer)info);
+ break;
+ case PT_COLOR:
+ g_signal_connect (G_OBJECT (info->widget), "color_set",
+ G_CALLBACK(prefs_color_changed_cb),
+ (gpointer)info);
+ break;
+ case PT_OPTIONMENU:
+ g_signal_connect (G_OBJECT (info->widget),
+ "changed",
+ G_CALLBACK(prefs_optionmenu_selected_cb),
+ (gpointer)info);
+ break;
+ case PT_ENTRY:
+ g_signal_connect (G_OBJECT (info->widget), "changed",
+ G_CALLBACK(prefs_entry_changed_cb),
+ (gpointer)info);
+ break;
+ case PT_UNKNOWN:
+ break;
+ }
+ }
+}
+
+static void
+ephy_dialog_init (EphyDialog *dialog)
+{
+ dialog->priv = g_new0 (EphyDialogPrivate, 1);
+
+ dialog->priv->parent = NULL;
+ dialog->priv->dialog = NULL;
+ dialog->priv->props = NULL;
+ dialog->priv->spin_timer = NULL;
+ dialog->priv->name = NULL;
+}
+
+static void
+prefs_set_sensitivity (PropertyInfo *props)
+{
+ int i;
+
+ for (i=0 ; props[i].id >= 0; i++)
+ {
+ if (props[i].sg == NULL) continue;
+
+ g_return_if_fail (props[i].widget != NULL);
+
+ if (GTK_IS_RADIO_BUTTON(props[i].widget) ||
+ GTK_IS_TOGGLE_BUTTON(props[i].widget))
+ {
+ prefs_set_group_sensitivity (props[i].widget,
+ props[i].type,
+ props[i].sg);
+ }
+ }
+}
+
+static void
+load_props (PropertyInfo *props)
+{
+ int i;
+
+ for (i=0 ; props[i].id >= 0; i++)
+ {
+ if (props[i].pref == NULL) continue;
+
+ g_return_if_fail (props[i].widget != NULL);
+
+ if (GTK_IS_SPIN_BUTTON(props[i].widget))
+ {
+ ephy_pu_set_spin_button_from_config (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_RADIO_BUTTON(props[i].widget))
+ {
+ ephy_pu_set_radiobuttongroup_from_config (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_TOGGLE_BUTTON(props[i].widget))
+ {
+ ephy_pu_set_togglebutton_from_config (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_EDITABLE(props[i].widget))
+ {
+ ephy_pu_set_editable_from_config (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_OPTION_MENU(props[i].widget))
+ {
+ ephy_pu_set_optionmenu_from_config (props[i].widget,
+ props[i].pref);
+ }
+ else if (GNOME_IS_COLOR_PICKER(props[i].widget))
+ {
+ ephy_pu_set_color_from_config (props[i].widget,
+ props[i].pref);
+ }
+ }
+
+}
+
+static void
+save_props (PropertyInfo *props)
+{
+ int i;
+
+ for (i=0 ; props[i].id >= 0; i++)
+ {
+ if ((props[i].pref == NULL) ||
+ (props[i].type != PT_NORMAL)) continue;
+ g_return_if_fail (props[i].widget != NULL);
+
+ if (GTK_IS_SPIN_BUTTON(props[i].widget))
+ {
+ ephy_pu_set_config_from_spin_button (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_RADIO_BUTTON(props[i].widget))
+ {
+ ephy_pu_set_config_from_radiobuttongroup (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_TOGGLE_BUTTON(props[i].widget))
+ {
+ ephy_pu_set_config_from_togglebutton (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_EDITABLE(props[i].widget))
+ {
+ ephy_pu_set_config_from_editable (props[i].widget,
+ props[i].pref);
+ }
+ else if (GTK_IS_OPTION_MENU(props[i].widget))
+ {
+ ephy_pu_set_config_from_optionmenu (props[i].widget,
+ props[i].pref);
+ }
+ else if (GNOME_IS_COLOR_PICKER(props[i].widget))
+ {
+ ephy_pu_set_config_from_color (props[i].widget,
+ props[i].pref);
+ }
+ }
+}
+
+static void
+ephy_dialog_finalize (GObject *object)
+{
+ EphyDialog *dialog;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_EPHY_DIALOG (object));
+
+ dialog = EPHY_DIALOG (object);
+
+ g_return_if_fail (dialog->priv != NULL);
+
+ if (dialog->priv->dialog)
+ {
+ ephy_dialog_destruct (dialog);
+ }
+
+ g_free (dialog->priv->name);
+ g_free (dialog->priv->props);
+ g_free (dialog->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+ephy_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyDialog *d = EPHY_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_PARENT_WINDOW:
+ ephy_dialog_set_parent (d, g_value_get_object (value));
+ break;
+ case PROP_MODAL:
+ ephy_dialog_set_modal (d, g_value_get_boolean (value));
+ break;
+ }
+}
+
+static void
+ephy_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyDialog *d = EPHY_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_PARENT_WINDOW:
+ g_value_set_object (value, d->priv->parent);
+ break;
+ case PROP_MODAL:
+ g_value_set_boolean (value, d->priv->modal);
+ }
+}
+
+static void
+ephy_dialog_set_parent (EphyDialog *dialog,
+ GtkWidget *parent)
+{
+ g_return_if_fail (dialog->priv->parent == NULL);
+ g_return_if_fail (GTK_IS_WINDOW(parent));
+ g_return_if_fail (GTK_IS_WINDOW(dialog->priv->dialog));
+
+ dialog->priv->parent = parent;
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog->priv->dialog),
+ GTK_WINDOW (parent));
+}
+
+EphyDialog *
+ephy_dialog_new (void)
+{
+ return EPHY_DIALOG (g_object_new (EPHY_DIALOG_TYPE, NULL));
+}
+
+EphyDialog *
+ephy_dialog_new_with_parent (GtkWidget *parent_window)
+{
+ return EPHY_DIALOG (g_object_new (EPHY_DIALOG_TYPE,
+ "ParentWindow", parent_window,
+ NULL));
+}
+
+void ephy_dialog_show_embedded (EphyDialog *dialog,
+ GtkWidget *container)
+{
+ dialog->priv->container = container;
+ gtk_container_add (GTK_CONTAINER(container),
+ dialog->priv->dialog);
+ gtk_widget_show (dialog->priv->dialog);
+}
+
+void
+ephy_dialog_remove_embedded (EphyDialog *dialog)
+{
+ g_object_ref (G_OBJECT(dialog->priv->dialog));
+ gtk_container_remove (GTK_CONTAINER(dialog->priv->container),
+ dialog->priv->dialog);
+}
+
+static PropertyInfo *
+init_props (const EphyDialogProperty *properties, GladeXML *gxml)
+{
+ PropertyInfo *props;
+ int i;
+
+ for (i=0 ; properties[i].control_name != NULL; i++);
+
+ props = g_new0 (PropertyInfo, i+1);
+
+ for (i=0 ; properties[i].control_name != NULL; i++)
+ {
+ props[i].id = properties[i].id;
+ props[i].widget = glade_xml_get_widget
+ (gxml, properties[i].control_name);
+ props[i].pref = properties[i].state_pref;
+ props[i].sg = properties[i].sg;
+ props[i].type = properties[i].type;
+ }
+
+ props[i].id = -1;
+ props[i].widget = NULL;
+ props[i].pref = NULL;
+ props[i].sg = NULL;
+ props[i].type = 0;
+
+ return props;
+}
+
+static void
+dialog_destruction_notify (EphyDialog *dialog,
+ GObject *where_the_object_was)
+{
+ dialog->priv->dialog = NULL;
+ ephy_dialog_destruct (dialog);
+ g_object_unref (dialog);
+}
+
+static void
+dialog_destroy_cb (GtkWidget *widget, EphyDialog *dialog)
+{
+ if (dialog->priv->props &&
+ dialog->priv->dialog)
+ {
+ save_props (dialog->priv->props);
+ }
+}
+
+static void
+impl_construct (EphyDialog *dialog,
+ const EphyDialogProperty *properties,
+ const char *file,
+ const char *name)
+{
+ GladeXML *gxml;
+
+ gxml = ephy_glade_widget_new
+ (file, name, &(dialog->priv->dialog), dialog);
+
+ if (dialog->priv->name == NULL)
+ {
+ dialog->priv->name = g_strdup (name);
+ }
+
+ if (properties)
+ {
+ dialog->priv->props = init_props (properties, gxml);
+ }
+
+ g_signal_connect (dialog->priv->dialog,
+ "destroy",
+ G_CALLBACK(dialog_destroy_cb),
+ dialog);
+
+ g_object_unref (gxml);
+
+ g_object_weak_ref (G_OBJECT(dialog->priv->dialog),
+ (GWeakNotify)dialog_destruction_notify,
+ dialog);
+
+ if (dialog->priv->props)
+ {
+ load_props (dialog->priv->props);
+ prefs_connect_signals (dialog);
+ prefs_set_sensitivity (dialog->priv->props);
+ }
+}
+
+static void
+impl_destruct (EphyDialog *dialog)
+{
+ if (dialog->priv->dialog)
+ {
+ g_object_weak_unref (G_OBJECT(dialog->priv->dialog),
+ (GWeakNotify)dialog_destruction_notify,
+ dialog);
+ gtk_widget_destroy (dialog->priv->dialog);
+ dialog->priv->dialog = NULL;
+ }
+}
+
+static GtkWidget *
+impl_get_control (EphyDialog *dialog,
+ int property_id)
+{
+ return dialog->priv->props[property_id].widget;
+}
+
+static void
+impl_get_value (EphyDialog *dialog,
+ int property_id,
+ GValue *value)
+{
+ GtkWidget *widget = ephy_dialog_get_control (dialog,
+ property_id);
+
+ if (GTK_IS_SPIN_BUTTON (widget))
+ {
+ float val;
+ g_value_init (value, G_TYPE_FLOAT);
+ val = gtk_spin_button_get_value (GTK_SPIN_BUTTON(widget));
+ g_value_set_float (value, val);
+ }
+ else if (GTK_IS_RADIO_BUTTON (widget))
+ {
+ int val;
+ g_value_init (value, G_TYPE_INT);
+ val = ephy_gui_gtk_radio_button_get (GTK_RADIO_BUTTON(widget));
+ g_value_set_int (value, val);
+ }
+ else if (GTK_IS_TOGGLE_BUTTON (widget))
+ {
+ g_value_init (value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (value, gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(widget)));
+ }
+ else if (GTK_IS_EDITABLE (widget))
+ {
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, gtk_editable_get_chars
+ (GTK_EDITABLE (widget), 0, -1));
+ }
+ else if (GTK_IS_OPTION_MENU (widget))
+ {
+ int val;
+ g_value_init (value, G_TYPE_INT);
+ val = gtk_option_menu_get_history (GTK_OPTION_MENU(widget));
+ g_value_set_int (value, val);
+ }
+}
+
+static gboolean
+ephy_dialog_configure_event_cb (GtkWidget *widget,
+ GdkEventConfigure *event,
+ EphyDialog *dialog)
+{
+ ephy_state_save_window (widget, dialog->priv->name);
+
+ return FALSE;
+}
+
+static void
+setup_default_size (EphyDialog *dialog)
+{
+ ephy_state_load_window (dialog->priv->dialog,
+ dialog->priv->name, -1, -1, FALSE);
+
+ g_signal_connect (dialog->priv->dialog,
+ "configure_event",
+ G_CALLBACK (ephy_dialog_configure_event_cb),
+ dialog);
+}
+
+static gint
+impl_run (EphyDialog *dialog)
+{
+ setup_default_size (dialog);
+
+ return gtk_dialog_run (GTK_DIALOG(dialog->priv->dialog));
+}
+
+static void
+impl_show (EphyDialog *dialog)
+{
+ setup_default_size (dialog);
+
+ if (dialog->priv->parent)
+ {
+ /* make the dialog transient again, because it seems to get
+ * forgotten after gtk_widget_hide
+ */
+ gtk_window_set_transient_for (GTK_WINDOW (dialog->priv->dialog),
+ GTK_WINDOW (dialog->priv->parent));
+ }
+ gtk_window_present (GTK_WINDOW(dialog->priv->dialog));
+}
+
+void
+ephy_dialog_set_modal (EphyDialog *dialog,
+ gboolean is_modal)
+{
+ dialog->priv->modal = is_modal;
+
+ gtk_window_set_modal (GTK_WINDOW(dialog->priv->dialog),
+ is_modal);
+}
+
+void
+ephy_dialog_construct (EphyDialog *dialog,
+ const EphyDialogProperty *properties,
+ const char *file,
+ const char *name)
+{
+ EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
+ return klass->construct (dialog, properties, file, name);
+}
+
+void
+ephy_dialog_destruct (EphyDialog *dialog)
+{
+ EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
+ klass->destruct (dialog);
+}
+
+gint
+ephy_dialog_run (EphyDialog *dialog)
+{
+ EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
+ return klass->run (dialog);
+}
+
+void
+ephy_dialog_show (EphyDialog *dialog)
+{
+ EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
+ klass->show (dialog);
+}
+
+GtkWidget *
+ephy_dialog_get_control (EphyDialog *dialog,
+ int property_id)
+{
+ EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
+ return klass->get_control (dialog, property_id);
+}
+
+void
+ephy_dialog_get_value (EphyDialog *dialog,
+ int property_id,
+ GValue *value)
+{
+ EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
+ return klass->get_value (dialog, property_id, value);
+}
+
diff --git a/lib/ephy-dialog.h b/lib/ephy-dialog.h
new file mode 100644
index 000000000..24cb2cf5c
--- /dev/null
+++ b/lib/ephy-dialog.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_DIALOG_H
+#define EPHY_DIALOG_H
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+typedef struct EphyDialogClass EphyDialogClass;
+
+#define EPHY_DIALOG_TYPE (ephy_dialog_get_type ())
+#define EPHY_DIALOG(obj) (GTK_CHECK_CAST ((obj), EPHY_DIALOG_TYPE, EphyDialog))
+#define EPHY_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_DIALOG_TYPE, EphyDialogClass))
+#define IS_EPHY_DIALOG(obj) (GTK_CHECK_TYPE ((obj), EPHY_DIALOG_TYPE))
+#define IS_EPHY_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_DIALOG))
+#define EPHY_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_DIALOG_TYPE, EphyDialogClass))
+
+typedef struct EphyDialog EphyDialog;
+typedef struct EphyDialogPrivate EphyDialogPrivate;
+
+#define SY_BEGIN_GROUP -20
+#define SY_END_GROUP -21
+#define SY_END -22
+#define SY_BEGIN_GROUP_INVERSE -23
+
+struct EphyDialog
+{
+ GObject parent;
+ EphyDialogPrivate *priv;
+};
+
+typedef enum
+{
+ PT_NORMAL,
+ PT_AUTOAPPLY
+} PropertyType;
+
+typedef struct
+{
+ int id;
+ const char *control_name;
+ const char *state_pref;
+ PropertyType type;
+ int *sg;
+} EphyDialogProperty;
+
+struct EphyDialogClass
+{
+ GObjectClass parent_class;
+
+ void (* construct) (EphyDialog *dialog,
+ const EphyDialogProperty *properties,
+ const char *file,
+ const char *name);
+ void (* destruct) (EphyDialog *dialog);
+ gint (* run) (EphyDialog *dialog);
+ void (* show) (EphyDialog *dialog);
+ GtkWidget * (* get_control) (EphyDialog *dialog,
+ int property_id);
+ void (* get_value) (EphyDialog *dialog,
+ int property_id,
+ GValue *value);
+};
+
+GType ephy_dialog_get_type (void);
+
+EphyDialog *ephy_dialog_new (void);
+
+EphyDialog *ephy_dialog_new_with_parent (GtkWidget *parent_window);
+
+void ephy_dialog_construct (EphyDialog *dialog,
+ const EphyDialogProperty *properties,
+ const char *file,
+ const char *name);
+
+void ephy_dialog_destruct (EphyDialog *dialog);
+
+gint ephy_dialog_run (EphyDialog *dialog);
+
+void ephy_dialog_show (EphyDialog *dialog);
+
+void ephy_dialog_show_embedded (EphyDialog *dialog,
+ GtkWidget *container);
+
+void ephy_dialog_remove_embedded (EphyDialog *dialog);
+
+void ephy_dialog_set_modal (EphyDialog *dialog,
+ gboolean is_modal);
+
+GtkWidget *ephy_dialog_get_control (EphyDialog *dialog,
+ int property_id);
+
+void ephy_dialog_get_value (EphyDialog *dialog,
+ int property_id,
+ GValue *value);
+
+G_END_DECLS
+
+#endif
+
diff --git a/lib/ephy-dnd.c b/lib/ephy-dnd.c
new file mode 100644
index 000000000..b70fa284a
--- /dev/null
+++ b/lib/ephy-dnd.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-dnd.h"
+
+#include <gtk/gtkselection.h>
+#include <gtk/gtktreeview.h>
+
+static GtkTargetEntry url_drag_types [] =
+{
+ { EPHY_DND_URI_LIST_TYPE, 0, EPHY_DND_URI_LIST },
+ { EPHY_DND_TEXT_TYPE, 0, EPHY_DND_TEXT },
+ { EPHY_DND_URL_TYPE, 0, EPHY_DND_URL }
+};
+
+/* Encode a "_NETSCAPE_URL_" selection.
+ * As far as I can tell, Netscape is expecting a single
+ * URL to be returned. I cannot discover a way to construct
+ * a list to be returned that Netscape can understand.
+ * GMC also fails to do this as well.
+ */
+static void
+add_one_netscape_url (const char *url, int x, int y, int w, int h, gpointer data)
+{
+ GString *result;
+
+ result = (GString *) data;
+ if (result->len == 0) {
+ g_string_append (result, url);
+ }
+}
+
+static void
+add_one_uri (const char *uri, int x, int y, int w, int h, gpointer data)
+{
+ GString *result;
+
+ result = (GString *) data;
+
+ g_string_append (result, uri);
+ g_string_append (result, "\r\n");
+}
+
+gboolean
+ephy_dnd_drag_data_get (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint32 time,
+ gpointer container_context,
+ EphyDragEachSelectedItemIterator each_selected_item_iterator)
+{
+ GString *result;
+
+ switch (info) {
+ case EPHY_DND_URI_LIST:
+ case EPHY_DND_TEXT:
+ result = g_string_new (NULL);
+ (* each_selected_item_iterator) (add_one_uri, container_context, result);
+ break;
+ case EPHY_DND_URL:
+ result = g_string_new (NULL);
+ (* each_selected_item_iterator) (add_one_netscape_url, container_context, result);
+ break;
+ default:
+ return FALSE;
+ }
+
+ gtk_selection_data_set (selection_data,
+ selection_data->target,
+ 8, result->str, result->len);
+
+ return TRUE;
+}
+
+void
+ephy_dnd_url_drag_source_set (GtkWidget *widget)
+{
+ gtk_drag_source_set (widget,
+ GDK_BUTTON1_MASK,
+ url_drag_types,
+ G_N_ELEMENTS (url_drag_types),
+ GDK_ACTION_COPY);
+}
+
+void
+ephy_dnd_enable_model_drag_source (GtkWidget *treeview)
+{
+ gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (treeview),
+ GDK_BUTTON1_MASK,
+ url_drag_types, G_N_ELEMENTS (url_drag_types),
+ GDK_ACTION_COPY);
+}
+
diff --git a/lib/ephy-dnd.h b/lib/ephy-dnd.h
new file mode 100644
index 000000000..87b6008d9
--- /dev/null
+++ b/lib/ephy-dnd.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_DND_H
+#define EPHY_DND_H
+
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkdnd.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_DND_NODE_PROPERTY 3
+
+/* Drag & Drop target names. */
+#define EPHY_DND_URI_LIST_TYPE "text/uri-list"
+#define EPHY_DND_TEXT_TYPE "text/plain"
+#define EPHY_DND_URL_TYPE "_NETSCAPE_URL"
+#define EPHY_DND_EPHY_URL_TYPE "EPHY_URL"
+#define EPHY_DND_EPHY_BOOKMARK_TYPE "EPHY_BOOKMARK"
+
+/* Standard Drag & Drop types. */
+typedef enum {
+ EPHY_DND_URI_LIST,
+ EPHY_DND_URL,
+ EPHY_DND_TEXT,
+} EphyIconDndTargetType;
+
+typedef void (* EphyDragEachSelectedItemDataGet) (const char *url,
+ int x, int y, int w, int h,
+ gpointer data);
+
+typedef void (* EphyDragEachSelectedItemIterator) (EphyDragEachSelectedItemDataGet iteratee,
+ gpointer iterator_context,
+ gpointer data);
+
+gboolean ephy_dnd_drag_data_get (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint32 time,
+ gpointer container_context,
+ EphyDragEachSelectedItemIterator each_selected_item_iterator);
+
+void ephy_dnd_url_drag_source_set (GtkWidget *widget);
+
+void ephy_dnd_enable_model_drag_source (GtkWidget *treeview);
+
+
+G_END_DECLS
+
+#endif
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
new file mode 100644
index 000000000..2e867e3f5
--- /dev/null
+++ b/lib/ephy-file-helpers.c
@@ -0,0 +1,326 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <glib.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-init.h>
+#include <libgnome/gnome-exec.h>
+
+#include "ephy-file-helpers.h"
+
+static GHashTable *files = NULL;
+
+static char *dot_dir = NULL;
+
+char *
+ephy_file_tmp_filename (const char *base,
+ const char *extension)
+{
+ int fd;
+ char *name = g_strdup (base);
+
+ fd = mkstemp (name);
+
+ if (fd != -1)
+ {
+ unlink (name);
+ close (fd);
+ }
+ else
+ {
+ return NULL;
+ }
+
+ if (extension)
+ {
+ char *tmp;
+ tmp = g_strconcat (name, ".",
+ extension, NULL);
+ g_free (name);
+ name = tmp;
+ }
+
+ return name;
+}
+
+const char *
+ephy_file (const char *filename)
+{
+ char *ret;
+ int i;
+
+ static char *paths[] =
+ {
+ SHARE_DIR "/",
+ SHARE_DIR "/glade/",
+ SHARE_DIR "/art/",
+ SHARE_UNINSTALLED_DIR "/",
+ SHARE_UNINSTALLED_DIR "/glade/",
+ SHARE_UNINSTALLED_DIR "/art/"
+ };
+
+ g_assert (files != NULL);
+
+ ret = g_hash_table_lookup (files, filename);
+ if (ret != NULL)
+ return ret;
+
+ for (i = 0; i < (int) G_N_ELEMENTS (paths); i++)
+ {
+ ret = g_strconcat (paths[i], filename, NULL);
+ if (g_file_test (ret, G_FILE_TEST_EXISTS) == TRUE)
+ {
+ g_hash_table_insert (files, g_strdup (filename), ret);
+ return (const char *) ret;
+ }
+ g_free (ret);
+ }
+
+ g_warning (_("Failed to find %s"), filename);
+
+ return NULL;
+}
+
+const char *
+ephy_dot_dir (void)
+{
+ if (dot_dir == NULL)
+ {
+ dot_dir = g_build_filename (g_get_home_dir (),
+ GNOME_DOT_GNOME,
+ "epiphany",
+ NULL);
+ }
+
+ return dot_dir;
+}
+
+void
+ephy_file_helpers_init (void)
+{
+ files = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_free);
+}
+
+void
+ephy_file_helpers_shutdown (void)
+{
+ g_hash_table_destroy (files);
+
+ g_free (dot_dir);
+}
+
+static void
+gul_general_gnome_shell_execute (const char *command)
+{
+ GError *error = NULL;
+ if (!g_spawn_command_line_async (command, &error)) {
+ g_warning ("Error starting command '%s': %s\n", command, error->message);
+ g_error_free (error);
+ }
+}
+
+/* Return a command string containing the path to a terminal on this system. */
+
+static char *
+try_terminal_command (const char *program,
+ const char *args)
+{
+ char *program_in_path, *quoted, *result;
+
+ if (program == NULL) {
+ return NULL;
+ }
+
+ program_in_path = g_find_program_in_path (program);
+ if (program_in_path == NULL) {
+ return NULL;
+ }
+
+ quoted = g_shell_quote (program_in_path);
+ if (args == NULL || args[0] == '\0') {
+ return quoted;
+ }
+ result = g_strconcat (quoted, " ", args, NULL);
+ g_free (quoted);
+ return result;
+}
+
+static char *
+try_terminal_command_argv (int argc,
+ char **argv)
+{
+ GString *string;
+ int i;
+ char *quoted, *result;
+
+ if (argc == 0) {
+ return NULL;
+ }
+
+ if (argc == 1) {
+ return try_terminal_command (argv[0], NULL);
+ }
+
+ string = g_string_new (argv[1]);
+ for (i = 2; i < argc; i++) {
+ quoted = g_shell_quote (argv[i]);
+ g_string_append_c (string, ' ');
+ g_string_append (string, quoted);
+ g_free (quoted);
+ }
+ result = try_terminal_command (argv[0], string->str);
+ g_string_free (string, TRUE);
+
+ return result;
+}
+
+static char *
+get_terminal_command_prefix (gboolean for_command)
+{
+ int argc;
+ char **argv;
+ char *command;
+ guint i;
+ static const char *const commands[][3] = {
+ { "gnome-terminal", "-x", "" },
+ { "dtterm", "-e", "-ls" },
+ { "nxterm", "-e", "-ls" },
+ { "color-xterm", "-e", "-ls" },
+ { "rxvt", "-e", "-ls" },
+ { "xterm", "-e", "-ls" },
+ };
+
+ /* Try the terminal from preferences. Use without any
+ * arguments if we are just doing a standalone terminal.
+ */
+ argc = 0;
+ argv = g_new0 (char *, 1);
+ gnome_prepend_terminal_to_vector (&argc, &argv);
+
+ command = NULL;
+ if (argc != 0) {
+ if (for_command) {
+ command = try_terminal_command_argv (argc, argv);
+ } else {
+ /* Strip off the arguments in a lame attempt
+ * to make it be an interactive shell.
+ */
+ command = try_terminal_command (argv[0], NULL);
+ }
+ }
+
+ while (argc != 0) {
+ g_free (argv[--argc]);
+ }
+ g_free (argv);
+
+ if (command != NULL) {
+ return command;
+ }
+
+ /* Try well-known terminal applications in same order that gmc did. */
+ for (i = 0; i < G_N_ELEMENTS (commands); i++) {
+ command = try_terminal_command (commands[i][0],
+ commands[i][for_command ? 1 : 2]);
+ if (command != NULL) {
+ break;
+ }
+ }
+
+ return command;
+}
+
+static char *
+gul_general_gnome_make_terminal_command (const char *command)
+{
+ char *prefix, *quoted, *terminal_command;
+
+ if (command == NULL) {
+ return get_terminal_command_prefix (FALSE);
+ }
+ prefix = get_terminal_command_prefix (TRUE);
+ quoted = g_shell_quote (command);
+ terminal_command = g_strconcat (prefix, " /bin/sh -c ", quoted, NULL);
+ g_free (prefix);
+ g_free (quoted);
+ return terminal_command;
+}
+
+static void
+gul_general_gnome_open_terminal (const char *command)
+{
+ char *command_line;
+
+ command_line = gul_general_gnome_make_terminal_command (command);
+ if (command_line == NULL) {
+ g_message ("Could not start a terminal");
+ return;
+ }
+ gul_general_gnome_shell_execute (command_line);
+ g_free (command_line);
+}
+
+void
+ephy_file_launch_application (const char *command_string,
+ const char *parameter,
+ gboolean use_terminal)
+{
+ char *full_command;
+ char *quoted_parameter;
+
+ if (parameter != NULL) {
+ quoted_parameter = g_shell_quote (parameter);
+ full_command = g_strconcat (command_string, " ", quoted_parameter, NULL);
+ g_free (quoted_parameter);
+ } else {
+ full_command = g_strdup (command_string);
+ }
+
+ if (use_terminal) {
+ gul_general_gnome_open_terminal (full_command);
+ } else {
+ gul_general_gnome_shell_execute (full_command);
+ }
+
+ g_free (full_command);
+}
+
+void
+ephy_ensure_dir_exists (const char *dir)
+{
+ if (g_file_test (dir, G_FILE_TEST_IS_DIR) == FALSE)
+ {
+ if (g_file_test (dir, G_FILE_TEST_EXISTS) == TRUE)
+ g_error (_("%s exists, please move it out of the way."), dir);
+
+ if (mkdir (dir, 488) != 0)
+ g_error (_("Failed to create directory %s."), dir);
+ }
+}
diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h
new file mode 100644
index 000000000..75f6a0e9e
--- /dev/null
+++ b/lib/ephy-file-helpers.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef EPHY_FILE_HELPERS_H
+#define EPHY_FILE_HELPERS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+const char *ephy_file (const char *filename);
+
+const char *ephy_dot_dir (void);
+
+void ephy_file_helpers_init (void);
+
+void ephy_file_helpers_shutdown (void);
+
+void ephy_file_launch_application (const char *command_string,
+ const char *parameter,
+ gboolean use_terminal);
+
+char *ephy_file_tmp_filename (const char *base,
+ const char *extension);
+
+void ephy_ensure_dir_exists (const char *dir);
+
+
+G_END_DECLS
+
+#endif /* EPHY_FILE_HELPERS_H */
diff --git a/lib/ephy-filesystem-autocompletion.c b/lib/ephy-filesystem-autocompletion.c
new file mode 100644
index 000000000..8b1cb84fb
--- /dev/null
+++ b/lib/ephy-filesystem-autocompletion.c
@@ -0,0 +1,343 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernández Pascual
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ephy-autocompletion-source.h"
+#include "ephy-filesystem-autocompletion.h"
+#include "ephy-gobject-misc.h"
+#include <string.h>
+
+#include <libgnomevfs/gnome-vfs-async-ops.h>
+
+#define NOT_IMPLEMENTED g_warning ("not implemented: " G_STRLOC);
+
+//#define DEBUG_MSG(x) g_print x
+#define DEBUG_MSG(x)
+
+/**
+ * Private data
+ */
+struct _EphyFilesystemAutocompletionPrivate {
+ gchar *current_dir;
+ gchar *base_dir;
+ GnomeVFSURI *base_dir_uri;
+ gchar *basic_key;
+ gchar *basic_key_dir;
+ GSList *files;
+
+ guint score;
+ GnomeVFSAsyncHandle *load_handle;
+};
+
+/**
+ * Private functions, only availble from this file
+ */
+static void ephy_filesystem_autocompletion_class_init (EphyFilesystemAutocompletionClass *klass);
+static void ephy_filesystem_autocompletion_init (EphyFilesystemAutocompletion *as);
+static void ephy_filesystem_autocompletion_finalize_impl (GObject *o);
+static void ephy_filesystem_autocompletion_autocompletion_source_init (EphyAutocompletionSourceIface *iface);
+static void ephy_filesystem_autocompletion_autocompletion_source_foreach (EphyAutocompletionSource *source,
+ const gchar *current_text,
+ EphyAutocompletionSourceForeachFunc func,
+ gpointer data);
+void ephy_filesystem_autocompletion_autocompletion_source_set_basic_key (EphyAutocompletionSource *source,
+ const gchar *basic_key);
+static void ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (EphyFilesystemAutocompletion *gh);
+static void ephy_filesystem_autocompletion_set_current_dir (EphyFilesystemAutocompletion *fa, const gchar *d);
+
+
+static gpointer g_object_class;
+
+/**
+ * FilesystemAutocompletion object
+ */
+MAKE_GET_TYPE_IFACE (ephy_filesystem_autocompletion, "EphyFilesystemAutocompletion", EphyFilesystemAutocompletion,
+ ephy_filesystem_autocompletion_class_init, ephy_filesystem_autocompletion_init, G_TYPE_OBJECT,
+ ephy_filesystem_autocompletion_autocompletion_source_init, EPHY_TYPE_AUTOCOMPLETION_SOURCE);
+
+static void
+ephy_filesystem_autocompletion_autocompletion_source_init (EphyAutocompletionSourceIface *iface)
+{
+ iface->foreach = ephy_filesystem_autocompletion_autocompletion_source_foreach;
+ iface->set_basic_key = ephy_filesystem_autocompletion_autocompletion_source_set_basic_key;
+}
+
+static void
+ephy_filesystem_autocompletion_class_init (EphyFilesystemAutocompletionClass *klass)
+{
+ G_OBJECT_CLASS (klass)->finalize = ephy_filesystem_autocompletion_finalize_impl;
+
+ g_object_class = g_type_class_peek_parent (klass);
+}
+
+static void
+ephy_filesystem_autocompletion_init (EphyFilesystemAutocompletion *e)
+{
+ EphyFilesystemAutocompletionPrivate *p = g_new0 (EphyFilesystemAutocompletionPrivate, 1);
+ e->priv = p;
+
+ p->score = G_MAXINT / 2;
+ p->base_dir = g_strdup ("");
+}
+
+static void
+ephy_filesystem_autocompletion_finalize_impl (GObject *o)
+{
+ EphyFilesystemAutocompletion *as = GUL_FILESYSTEM_AUTOCOMPLETION (o);
+ EphyFilesystemAutocompletionPrivate *p = as->priv;
+
+ DEBUG_MSG (("in ephy_filesystem_autocompletion_finalize_impl\n"));
+
+ g_free (p->basic_key);
+ g_free (p->basic_key_dir);
+ g_free (p->current_dir);
+ g_free (p->base_dir);
+ if (p->base_dir_uri)
+ {
+ gnome_vfs_uri_unref (p->base_dir_uri);
+ }
+
+ g_free (p);
+
+ G_OBJECT_CLASS (g_object_class)->finalize (o);
+}
+
+EphyFilesystemAutocompletion *
+ephy_filesystem_autocompletion_new (void)
+{
+ EphyFilesystemAutocompletion *ret = g_object_new (GUL_TYPE_FILESYSTEM_AUTOCOMPLETION, NULL);
+ return ret;
+}
+
+
+static gchar *
+gfa_get_nearest_dir (const gchar *path)
+{
+ gchar *ret;
+ const gchar *lastslash = rindex (path, '/');
+
+ if (lastslash)
+ {
+ if (!strcmp (path, "file://"))
+ {
+ /* without this, gnome-vfs does not recognize it as a dir */
+ ret = g_strdup ("file:///");
+ }
+ else
+ {
+ ret = g_strndup (path, lastslash - path + 1);
+ }
+ }
+ else
+ {
+ ret = g_strdup ("");
+ }
+
+ return ret;
+}
+
+static void
+ephy_filesystem_autocompletion_autocompletion_source_foreach (EphyAutocompletionSource *source,
+ const gchar *basic_key,
+ EphyAutocompletionSourceForeachFunc func,
+ gpointer data)
+{
+ EphyFilesystemAutocompletion *fa = GUL_FILESYSTEM_AUTOCOMPLETION (source);
+ EphyFilesystemAutocompletionPrivate *p = fa->priv;
+ GSList *li;
+
+ ephy_filesystem_autocompletion_autocompletion_source_set_basic_key (source, basic_key);
+
+ for (li = p->files; li; li = li->next)
+ {
+ func (source, li->data, li->data, li->data, FALSE, FALSE, p->score, data);
+ }
+
+}
+
+static void
+ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (EphyFilesystemAutocompletion *fa)
+{
+ g_signal_emit_by_name (fa, "data-changed");
+}
+
+static void
+gfa_load_directory_cb (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ GList *list,
+ guint entries_read,
+ gpointer callback_data)
+{
+ EphyFilesystemAutocompletion *fa = callback_data;
+ EphyFilesystemAutocompletionPrivate *p = fa->priv;
+ GList *li;
+ gchar *cd;
+
+ g_return_if_fail (p->load_handle == handle);
+
+ DEBUG_MSG (("gfa_load_directory_cb, entries_read == %d\n", entries_read));
+
+ if (entries_read <= 0)
+ {
+ return;
+ }
+
+ if (p->basic_key_dir[strlen (p->basic_key_dir) - 1] == G_DIR_SEPARATOR
+ || p->basic_key_dir[0] == '\0')
+ {
+ cd = g_strdup (p->basic_key_dir);
+ }
+ else
+ {
+ cd = g_strconcat (p->basic_key_dir, G_DIR_SEPARATOR_S, NULL);
+ }
+
+ for (li = list; li; li = li->next)
+ {
+ GnomeVFSFileInfo *i = li->data;
+ if (!(i->name[0] == '.'
+ && (i->name[1] == '\0'
+ || (i->name[1] == '.'
+ && i->name[2] == '\0'))))
+ {
+ gchar *f = g_strconcat (cd, i->name, NULL);
+ p->files = g_slist_prepend (p->files, f);
+
+ DEBUG_MSG (("+ %s\n", f));
+ }
+ }
+
+ g_free (cd);
+
+ ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (fa);
+}
+
+static void
+ephy_filesystem_autocompletion_set_current_dir (EphyFilesystemAutocompletion *fa, const gchar *d)
+{
+ EphyFilesystemAutocompletionPrivate *p = fa->priv;
+ GnomeVFSURI *cd_uri;
+
+ if (p->base_dir_uri)
+ {
+ cd_uri = gnome_vfs_uri_append_path (p->base_dir_uri, d);
+ }
+ else
+ {
+ cd_uri = gnome_vfs_uri_new (d);
+ }
+
+ if (p->load_handle)
+ {
+ gnome_vfs_async_cancel (p->load_handle);
+ p->load_handle = NULL;
+ }
+
+ if (p->files)
+ {
+ g_slist_foreach (p->files, (GFunc) g_free, NULL);
+ g_slist_free (p->files);
+ p->files = NULL;
+
+ ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (fa);
+ }
+
+ if (!cd_uri)
+ {
+ DEBUG_MSG (("Can't load dir %s\n", d));
+ return;
+ }
+
+ g_free (p->current_dir);
+ p->current_dir = gnome_vfs_uri_to_string (cd_uri, GNOME_VFS_URI_HIDE_NONE);
+
+ DEBUG_MSG (("Loading dir: %s\n", p->current_dir));
+
+ gnome_vfs_async_load_directory_uri (&p->load_handle,
+ cd_uri,
+ GNOME_VFS_FILE_INFO_DEFAULT,
+ 100,
+ 0,
+ gfa_load_directory_cb,
+ fa);
+
+ gnome_vfs_uri_unref (cd_uri);
+}
+
+void
+ephy_filesystem_autocompletion_autocompletion_source_set_basic_key (EphyAutocompletionSource *source,
+ const gchar *basic_key)
+{
+ EphyFilesystemAutocompletion *fa = GUL_FILESYSTEM_AUTOCOMPLETION (source);
+ EphyFilesystemAutocompletionPrivate *p = fa->priv;
+ gchar *new_basic_key_dir;
+
+ if (p->basic_key && !strcmp (p->basic_key, basic_key))
+ {
+ return;
+ }
+
+ g_free (p->basic_key);
+ p->basic_key = g_strdup (basic_key);
+
+ new_basic_key_dir = gfa_get_nearest_dir (basic_key);
+ if (p->basic_key_dir && !strcmp (p->basic_key_dir, new_basic_key_dir))
+ {
+ g_free (new_basic_key_dir);
+ }
+ else
+ {
+ g_free (p->basic_key_dir);
+ p->basic_key_dir = new_basic_key_dir;
+ ephy_filesystem_autocompletion_set_current_dir (fa, p->basic_key_dir);
+ }
+}
+
+void
+ephy_filesystem_autocompletion_set_base_dir (EphyFilesystemAutocompletion *fa, const gchar *d)
+{
+ EphyFilesystemAutocompletionPrivate *p = fa->priv;
+
+ g_free (p->base_dir);
+ p->base_dir = g_strdup (d);
+
+ if (p->base_dir_uri)
+ {
+ gnome_vfs_uri_unref (p->base_dir_uri);
+ }
+
+ if (p->base_dir[0])
+ {
+ p->base_dir_uri = gnome_vfs_uri_new (p->base_dir);
+ }
+ else
+ {
+ p->base_dir_uri = NULL;
+ }
+
+ if (p->base_dir_uri)
+ {
+ gchar *t = gnome_vfs_uri_to_string (p->base_dir_uri, GNOME_VFS_URI_HIDE_NONE);
+ DEBUG_MSG (("base_dir: %s\n", t));
+ g_free (t);
+ }
+}
+
diff --git a/lib/ephy-filesystem-autocompletion.h b/lib/ephy-filesystem-autocompletion.h
new file mode 100644
index 000000000..ec047282f
--- /dev/null
+++ b/lib/ephy-filesystem-autocompletion.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernández Pascual
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_FILESYSTEM_AUTOCOMPLETION_H
+#define EPHY_FILESYSTEM_AUTOCOMPLETION_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* object forward declarations */
+
+typedef struct _EphyFilesystemAutocompletion EphyFilesystemAutocompletion;
+typedef struct _EphyFilesystemAutocompletionClass EphyFilesystemAutocompletionClass;
+typedef struct _EphyFilesystemAutocompletionPrivate EphyFilesystemAutocompletionPrivate;
+
+/**
+ * FilesystemAutocompletion object
+ */
+
+#define GUL_TYPE_FILESYSTEM_AUTOCOMPLETION (ephy_filesystem_autocompletion_get_type())
+#define GUL_FILESYSTEM_AUTOCOMPLETION(object) (G_TYPE_CHECK_INSTANCE_CAST((object), \
+ GUL_TYPE_FILESYSTEM_AUTOCOMPLETION,\
+ EphyFilesystemAutocompletion))
+#define GUL_FILESYSTEM_AUTOCOMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GUL_TYPE_FILESYSTEM_AUTOCOMPLETION,\
+ EphyFilesystemAutocompletionClass))
+#define GUL_IS_FILESYSTEM_AUTOCOMPLETION(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), \
+ GUL_TYPE_FILESYSTEM_AUTOCOMPLETION))
+#define GUL_IS_FILESYSTEM_AUTOCOMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GUL_TYPE_FILESYSTEM_AUTOCOMPLETION))
+#define GUL_FILESYSTEM_AUTOCOMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GUL_TYPE_FILESYSTEM_AUTOCOMPLETION,\
+ EphyFilesystemAutocompletionClass))
+
+struct _EphyFilesystemAutocompletionClass
+{
+ GObjectClass parent_class;
+
+};
+
+struct _EphyFilesystemAutocompletion
+{
+ GObject parent_object;
+ EphyFilesystemAutocompletionPrivate *priv;
+};
+
+GType ephy_filesystem_autocompletion_get_type (void);
+EphyFilesystemAutocompletion * ephy_filesystem_autocompletion_new (void);
+void ephy_filesystem_autocompletion_set_base_dir (EphyFilesystemAutocompletion *fa,
+ const gchar *d);
+
+G_END_DECLS
+
+#endif
diff --git a/lib/ephy-glade.c b/lib/ephy-glade.c
new file mode 100644
index 000000000..beb91827f
--- /dev/null
+++ b/lib/ephy-glade.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-glade.h"
+#include "ephy-file-helpers.h"
+
+#include <glade/glade-xml.h>
+#include <gtk/gtkmenu.h>
+#include <gmodule.h>
+
+static void
+glade_signal_connect_func (const gchar *cb_name, GObject *obj,
+ const gchar *signal_name, const gchar *signal_data,
+ GObject *conn_obj, gboolean conn_after,
+ gpointer user_data);
+
+/**
+ * ephy_widget_new: build a new widget of the provided name, with all
+ * signals attached and data set to the provided parameter.
+ */
+GladeXML *
+ephy_glade_widget_new (const char *file, const char *widget_name,
+ GtkWidget **root, gpointer data)
+{
+ GladeXML *gxml;
+ const char *glade_file;
+
+ glade_file = ephy_file (file);
+ g_return_val_if_fail (glade_file != NULL, NULL);
+
+ /* build the widget */
+ /* note that libglade automatically caches the parsed file,
+ * so we don't need to worry about the efficiency of this */
+ gxml = glade_xml_new (glade_file, widget_name, NULL);
+ g_return_val_if_fail (gxml != NULL, NULL);
+
+ /* lookup the root widget if requested */
+ if (root != NULL)
+ {
+ *root = glade_xml_get_widget (gxml, widget_name);
+ }
+
+ /* connect signals and data */
+ glade_xml_signal_autoconnect_full
+ (gxml, (GladeXMLConnectFunc)glade_signal_connect_func, data);
+
+ /* return xml document for subsequent widget lookups */
+ return gxml;
+}
+
+/*
+ * glade_signal_connect_func: used by glade_xml_signal_autoconnect_full
+ */
+static void
+glade_signal_connect_func (const gchar *cb_name, GObject *obj,
+ const gchar *signal_name, const gchar *signal_data,
+ GObject *conn_obj, gboolean conn_after,
+ gpointer user_data)
+{
+ /** Module with all the symbols of the program */
+ static GModule *mod_self = NULL;
+ gpointer handler_func;
+
+ /* initialize gmodule */
+ if (mod_self == NULL)
+ {
+ mod_self = g_module_open (NULL, 0);
+ g_assert (mod_self != NULL);
+ }
+
+ /*g_print( "glade_signal_connect_func: cb_name = '%s', signal_name = '%s', signal_data = '%s'\n",
+ cb_name, signal_name, signal_data ); */
+
+ if (g_module_symbol (mod_self, cb_name, &handler_func))
+ {
+ /* found callback */
+ if (conn_obj)
+ {
+ if (conn_after)
+ {
+ g_signal_connect_object
+ (obj, signal_name,
+ handler_func, conn_obj,
+ G_CONNECT_AFTER);
+ }
+ else
+ {
+ g_signal_connect_object
+ (obj, signal_name,
+ handler_func, conn_obj,
+ G_CONNECT_SWAPPED);
+ }
+ }
+ else
+ {
+ /* no conn_obj; use standard connect */
+ gpointer data = NULL;
+
+ data = user_data;
+
+ if (conn_after)
+ {
+ g_signal_connect_after
+ (obj, signal_name,
+ handler_func, data);
+ }
+ else
+ {
+ g_signal_connect
+ (obj, signal_name,
+ handler_func, data);
+ }
+ }
+ }
+ else
+ {
+ g_warning("callback function not found: %s", cb_name);
+ }
+}
diff --git a/lib/ephy-glade.h b/lib/ephy-glade.h
new file mode 100644
index 000000000..cccf22f24
--- /dev/null
+++ b/lib/ephy-glade.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_GLADE_H
+#define EPHY_GLADE_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <glade/glade-xml.h>
+
+typedef struct
+{
+ const gchar *name;
+ GtkWidget **ptr;
+} WidgetLookup;
+
+G_BEGIN_DECLS
+
+GladeXML *ephy_glade_widget_new (const char *file,
+ const char *widget_name,
+ GtkWidget **root,
+ gpointer data);
+
+G_END_DECLS
+
+#endif
diff --git a/lib/ephy-gobject-misc.h b/lib/ephy-gobject-misc.h
new file mode 100644
index 000000000..c14ef1ae7
--- /dev/null
+++ b/lib/ephy-gobject-misc.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernández Pascual
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#define MAKE_GET_TYPE(l,str,t,ci,i,parent) \
+GType l##_get_type(void)\
+{\
+ static GType type = 0; \
+ if (!type) { \
+ static GTypeInfo const object_info = { \
+ sizeof (t##Class), \
+ \
+ (GBaseInitFunc) NULL, \
+ (GBaseFinalizeFunc) NULL, \
+ \
+ (GClassInitFunc) ci, \
+ (GClassFinalizeFunc) NULL, \
+ NULL, /* class_data */ \
+ \
+ sizeof (t), \
+ 0, /* n_preallocs */ \
+ (GInstanceInitFunc) i, \
+ }; \
+ type = g_type_register_static (parent, str, &object_info, 0); \
+ } \
+ return type; \
+}
+
+#define MAKE_GET_TYPE_IFACE(l,str,t,ci,i,parent,ii,iparent) \
+GType l##_get_type(void)\
+{\
+ static GType type = 0; \
+ if (!type) { \
+ static GTypeInfo const object_info = { \
+ sizeof (t##Class), \
+ \
+ (GBaseInitFunc) NULL, \
+ (GBaseFinalizeFunc) NULL, \
+ \
+ (GClassInitFunc) ci, \
+ (GClassFinalizeFunc) NULL, \
+ NULL, /* class_data */ \
+ \
+ sizeof (t), \
+ 0, /* n_preallocs */ \
+ (GInstanceInitFunc) i, \
+ }; \
+ \
+ static const GInterfaceInfo iface_info = { \
+ (GInterfaceInitFunc) ii, \
+ NULL, \
+ NULL \
+ }; \
+ \
+ type = g_type_register_static (parent, str, &object_info, (GTypeFlags)0); \
+ \
+ g_type_add_interface_static (type, \
+ iparent, \
+ &iface_info); \
+ } \
+ return type; \
+}
+
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
new file mode 100644
index 000000000..fe4018d38
--- /dev/null
+++ b/lib/ephy-gui.c
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-gui.h"
+#include "eel-gconf-extensions.h"
+
+#include <ctype.h>
+#include <string.h>
+#include <libgnome/gnome-i18n.h>
+#include <gtk/gtktreemodel.h>
+
+/* Styles for tab labels */
+GtkStyle *loading_text_style = NULL;
+GtkStyle *new_text_style = NULL;
+
+/**
+ * gul_gui_menu_position_under_widget:
+ */
+void
+ephy_gui_menu_position_under_widget (GtkMenu *menu,
+ gint *x,
+ gint *y,
+ gboolean *push_in,
+ gpointer user_data)
+{
+ GtkWidget *w = GTK_WIDGET (user_data);
+ gint width, height;
+ gint screen_width, screen_height;
+ GtkRequisition requisition;
+
+ gdk_drawable_get_size (w->window, &width, &height);
+ gdk_window_get_origin (w->window, x, y);
+ *y = *y + height;
+
+ gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+
+ screen_width = gdk_screen_width ();
+ screen_height = gdk_screen_height ();
+
+ *x = CLAMP (*x, 0, MAX (0, screen_width - requisition.width));
+ *y = CLAMP (*y, 0, MAX (0, screen_height - requisition.height));
+}
+
+/**
+ * gul_gui_gtk_radio_button_get: get the active member of a radiobutton
+ * group from one of the buttons in the group. This should be in GTK+!
+ */
+gint
+ephy_gui_gtk_radio_button_get (GtkRadioButton *radio_button)
+{
+ GtkToggleButton *toggle_button;
+ gint i, length;
+ GSList *list;
+
+ /* get group list */
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
+ length = g_slist_length (list);
+
+ /* iterate over list to find active button */
+ for (i = 0; list != NULL; i++, list = g_slist_next (list))
+ {
+ /* get button and text */
+ toggle_button = GTK_TOGGLE_BUTTON (list->data);
+ if (gtk_toggle_button_get_active (toggle_button))
+ {
+ break;
+ }
+ }
+
+ /* check we didn't run off end */
+ g_assert (list != NULL);
+
+ /* return index (reverse order!) */
+ return (length - 1) - i;
+}
+
+/**
+ * gul_gui_gtk_radio_button_set: set the active member of a radiobutton
+ * group from one of the buttons in the group. This should be in GTK+!
+ */
+void
+ephy_gui_gtk_radio_button_set (GtkRadioButton *radio_button, gint index)
+{
+ GtkToggleButton *button;
+ GSList *list;
+ gint length;
+
+ /* get the list */
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
+
+ /* check out the length */
+ length = g_slist_length (list);
+
+ /* new buttons are *preppended* to the list, so button added as first
+ * has last position in the list */
+ index = (length - 1) - index;
+
+ /* find the right button */
+ button = GTK_TOGGLE_BUTTON (g_slist_nth_data (list, index));
+
+ /* set it... this will de-activate the others in the group */
+ if (gtk_toggle_button_get_active (button) == FALSE)
+ {
+ gtk_toggle_button_set_active (button, TRUE);
+ }
+}
+
+GtkWidget *
+ephy_gui_append_new_menuitem (GtkWidget *menu,
+ const char *mnemonic,
+ GCallback callback,
+ gpointer data)
+{
+ GtkWidget *menu_item;
+
+ menu_item = gtk_menu_item_new_with_mnemonic (mnemonic);
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ menu_item);
+
+ if (callback)
+ {
+ g_signal_connect (G_OBJECT (menu_item),
+ "activate",
+ callback, data);
+ }
+
+ return menu_item;
+}
+
+GtkWidget *
+ephy_gui_append_new_menuitem_stock (GtkWidget *menu,
+ const char *stock_id,
+ GCallback callback,
+ gpointer data)
+{
+ GtkWidget *menu_item;
+
+ menu_item = gtk_image_menu_item_new_from_stock (stock_id, NULL);
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ menu_item);
+
+ if (callback)
+ {
+ g_signal_connect (G_OBJECT (menu_item),
+ "activate",
+ callback, data);
+ }
+
+ return menu_item;
+}
+
+GtkWidget *
+ephy_gui_append_new_menuitem_stock_icon (GtkWidget *menu,
+ const char *stock_id,
+ const char *mnemonic,
+ GCallback callback,
+ gpointer data)
+{
+ GtkWidget *menu_item;
+ GtkWidget *image;
+
+ menu_item = gtk_image_menu_item_new_with_mnemonic (mnemonic);
+ image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
+
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ menu_item);
+
+ if (callback)
+ {
+ g_signal_connect (G_OBJECT (menu_item),
+ "activate",
+ callback, data);
+ }
+
+ return menu_item;
+}
+
+GtkWidget *
+ephy_gui_append_new_check_menuitem (GtkWidget *menu,
+ const char *mnemonic,
+ gboolean value,
+ GCallback callback,
+ gpointer data)
+{
+ GtkWidget *menu_item;
+
+ menu_item = gtk_check_menu_item_new_with_mnemonic (mnemonic);
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ menu_item);
+
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), value);
+
+ if (callback)
+ {
+ g_signal_connect (G_OBJECT (menu_item),
+ "activate",
+ callback, data);
+ }
+
+ return menu_item;
+}
+
+GtkWidget *
+ephy_gui_append_separator (GtkWidget *menu)
+{
+ GtkWidget *menu_item;
+
+ menu_item = gtk_menu_item_new ();
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ menu_item);
+
+ return menu_item;
+}
+
+gboolean
+ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
+{
+ char *question;
+ GtkWidget *dialog;
+ gboolean res;
+
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+ {
+ return TRUE;
+ }
+
+ question = g_strdup_printf (_("File %s will be overwritten.\n"
+ "If you choose yes, the contents will be lost.\n\n"
+ "Do you want to continue?"), filename);
+ dialog = gtk_message_dialog_new (parent ? GTK_WINDOW(parent) : NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ question);
+ res = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES);
+ gtk_widget_destroy (dialog);
+ g_free (question);
+
+ return res;
+}
+
+static guint32
+shift_color_component (guchar component, float shift_by)
+{
+ guint32 result;
+ if (shift_by > 1.0) {
+ result = component * (2 - shift_by);
+ } else {
+ result = 0xff - shift_by * (0xff - component);
+ }
+
+ return result & 0xff;
+}
+
+/**
+ * ephy_gui_rgb_shift_color
+ * @color: A color.
+ * @shift_by: darken or lighten factor.
+ * Returns: An darkened or lightened rgb value.
+ *
+ * Darkens (@shift_by > 1) or lightens (@shift_by < 1)
+ * @color.
+ */
+guint32
+ephy_gui_rgb_shift_color (guint32 color, float shift_by)
+{
+ guint32 result;
+
+ /* shift red by shift_by */
+ result = shift_color_component((color & 0x00ff0000) >> 16, shift_by);
+ result <<= 8;
+ /* shift green by shift_by */
+ result |= shift_color_component((color & 0x0000ff00) >> 8, shift_by);
+ result <<= 8;
+ /* shift blue by shift_by */
+ result |= shift_color_component((color & 0x000000ff), shift_by);
+
+ /* alpha doesn't change */
+ result |= (0xff000000 & color);
+
+ return result;
+}
+
+static guint32
+rgb16_to_rgb (gushort r, gushort g, gushort b)
+{
+ guint32 result;
+
+ result = (0xff0000 | (r & 0xff00));
+ result <<= 8;
+ result |= ((g & 0xff00) | (b >> 8));
+
+ return result;
+}
+
+/**
+ * ephy_gui_gdk_color_to_rgb
+ * @color: A GdkColor style color.
+ * Returns: An rgb value.
+ *
+ * Converts from a GdkColor stlye color to a gdk_rgb one.
+ * Alpha gets set to fully opaque
+ */
+guint32
+ephy_gui_gdk_color_to_rgb (const GdkColor *color)
+{
+ return rgb16_to_rgb (color->red, color->green, color->blue);
+}
+
+/**
+ * ephy_gui_rgb_to_color
+ * @color: a gdk_rgb style value.
+ *
+ * Converts from a gdk_rgb value style to a GdkColor one.
+ * The gdk_rgb color alpha channel is ignored.
+ *
+ * Return value: A GdkColor structure version of the given RGB color.
+ */
+GdkColor
+ephy_gui_gdk_rgb_to_color (guint32 color)
+{
+ GdkColor result;
+
+ result.red = ((color >> 16) & 0xFF) * 0x101;
+ result.green = ((color >> 8) & 0xFF) * 0x101;
+ result.blue = (color & 0xff) * 0x101;
+ result.pixel = 0;
+
+ return result;
+}
diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h
new file mode 100644
index 000000000..0d736592f
--- /dev/null
+++ b/lib/ephy-gui.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2002 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_GUI_H
+#define EPHY_GUI_H
+
+/* system includes */
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <gnome.h>
+
+G_BEGIN_DECLS
+
+void ephy_gui_menu_position_under_widget (GtkMenu *menu,
+ gint *x,
+ gint *y,
+ gboolean *push_in,
+ gpointer user_data);
+
+gint ephy_gui_gtk_radio_button_get (GtkRadioButton *radio_button);
+
+void ephy_gui_gtk_radio_button_set (GtkRadioButton *radio_button,
+ gint index);
+
+GList *ephy_gui_treeview_get_selection_refs (GtkTreeView *treeview);
+
+GtkWidget *ephy_gui_append_new_menuitem (GtkWidget *menu,
+ const char *mnemonic,
+ GCallback callback,
+ gpointer data);
+
+GtkWidget *ephy_gui_append_new_menuitem_stock (GtkWidget *menu,
+ const char *stock_id,
+ GCallback callback,
+ gpointer data);
+
+GtkWidget *ephy_gui_append_new_menuitem_stock_icon (GtkWidget *menu,
+ const char *stock_id,
+ const char *mnemonic,
+ GCallback callback,
+ gpointer data);
+
+GtkWidget *ephy_gui_append_new_check_menuitem (GtkWidget *menu,
+ const char *mnemonic,
+ gboolean value,
+ GCallback callback,
+ gpointer data);
+
+GtkWidget *ephy_gui_append_separator (GtkWidget *menu);
+
+gboolean ephy_gui_confirm_overwrite_file (GtkWidget *parent,
+ const char *filename);
+
+guint32 ephy_gui_rgb_shift_color (guint32 color,
+ float shift_by);
+
+guint32 ephy_gui_gdk_color_to_rgb (const GdkColor *color);
+
+GdkColor ephy_gui_gdk_rgb_to_color (guint32 color);
+
+G_END_DECLS
+
+#endif
diff --git a/lib/ephy-marshal.list b/lib/ephy-marshal.list
new file mode 100644
index 000000000..9082cae25
--- /dev/null
+++ b/lib/ephy-marshal.list
@@ -0,0 +1,16 @@
+VOID:VOID
+VOID:STRING
+VOID:OBJECT
+VOID:OBJECT,OBJECT,INT
+VOID:OBJECT,STRING,INT
+VOID:OBJECT,INT
+VOID:OBJECT,INT,INT
+VOID:POINTER,INT
+VOID:STRING,INT,INT
+VOID:STRING,INT
+VOID:STRING,STRING
+INT:STRING
+VOID:INT,INT
+VOID:INT,INT,INT
+INT:OBJECT
+VOID:POINTER,POINTER
diff --git a/lib/ephy-node-filter.c b/lib/ephy-node-filter.c
new file mode 100644
index 000000000..8f0bddbc0
--- /dev/null
+++ b/lib/ephy-node-filter.c
@@ -0,0 +1,461 @@
+/*
+ * Copyright (C) 2002 Olivier Martin <omartin@ifrance.com>
+ * (C) 2002 Jorn Baayen <jorn@nl.linux.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include "ephy-node-filter.h"
+
+static void ephy_node_filter_class_init (EphyNodeFilterClass *klass);
+static void ephy_node_filter_init (EphyNodeFilter *node);
+static void ephy_node_filter_finalize (GObject *object);
+static gboolean ephy_node_filter_expression_evaluate (EphyNodeFilterExpression *expression,
+ EphyNode *node);
+
+enum
+{
+ CHANGED,
+ LAST_SIGNAL
+};
+
+struct EphyNodeFilterPrivate
+{
+ GPtrArray *levels;
+};
+
+struct EphyNodeFilterExpression
+{
+ EphyNodeFilterExpressionType type;
+
+ union
+ {
+ struct
+ {
+ EphyNode *a;
+ EphyNode *b;
+ } node_args;
+
+ struct
+ {
+ int prop_id;
+
+ union
+ {
+ EphyNode *node;
+ char *string;
+ int number;
+ } second_arg;
+ } prop_args;
+ } args;
+};
+
+static GObjectClass *parent_class = NULL;
+
+static guint ephy_node_filter_signals[LAST_SIGNAL] = { 0 };
+
+GType
+ephy_node_filter_get_type (void)
+{
+ static GType ephy_node_filter_type = 0;
+
+ if (ephy_node_filter_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyNodeFilterClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) ephy_node_filter_class_init,
+ NULL,
+ NULL,
+ sizeof (EphyNodeFilter),
+ 0,
+ (GInstanceInitFunc) ephy_node_filter_init
+ };
+
+ ephy_node_filter_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyNodeFilter",
+ &our_info, 0);
+ }
+
+ return ephy_node_filter_type;
+}
+
+static void
+ephy_node_filter_class_init (EphyNodeFilterClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_node_filter_finalize;
+
+ ephy_node_filter_signals[CHANGED] =
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyNodeFilterClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+static void
+ephy_node_filter_init (EphyNodeFilter *filter)
+{
+ filter->priv = g_new0 (EphyNodeFilterPrivate, 1);
+
+ filter->priv->levels = g_ptr_array_new ();
+}
+
+static void
+ephy_node_filter_finalize (GObject *object)
+{
+ EphyNodeFilter *filter;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (EPHY_IS_NODE_FILTER (object));
+
+ filter = EPHY_NODE_FILTER (object);
+
+ g_return_if_fail (filter->priv != NULL);
+
+ ephy_node_filter_empty (filter);
+
+ g_ptr_array_free (filter->priv->levels, FALSE);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+EphyNodeFilter *
+ephy_node_filter_new (void)
+{
+ EphyNodeFilter *filter;
+
+ filter = EPHY_NODE_FILTER (g_object_new (EPHY_TYPE_NODE_FILTER,
+ NULL));
+
+ g_return_val_if_fail (filter->priv != NULL, NULL);
+
+ return filter;
+}
+
+void
+ephy_node_filter_add_expression (EphyNodeFilter *filter,
+ EphyNodeFilterExpression *exp,
+ int level)
+{
+ while (level >= filter->priv->levels->len)
+ g_ptr_array_add (filter->priv->levels, NULL);
+
+ g_ptr_array_index (filter->priv->levels, level) =
+ g_list_append (g_ptr_array_index (filter->priv->levels, level), exp);
+}
+
+void
+ephy_node_filter_empty (EphyNodeFilter *filter)
+{
+ int i;
+
+ for (i = filter->priv->levels->len - 1; i >= 0; i--)
+ {
+ GList *list, *l;
+
+ list = g_ptr_array_index (filter->priv->levels, i);
+
+ for (l = list; l != NULL; l = g_list_next (l))
+ {
+ EphyNodeFilterExpression *exp;
+
+ exp = (EphyNodeFilterExpression *) l->data;
+
+ ephy_node_filter_expression_free (exp);
+ }
+
+ g_list_free (list);
+
+ g_ptr_array_remove_index (filter->priv->levels, i);
+ }
+}
+
+void
+ephy_node_filter_done_changing (EphyNodeFilter *filter)
+{
+ g_signal_emit (G_OBJECT (filter), ephy_node_filter_signals[CHANGED], 0);
+}
+
+/*
+ * We go through each level evaluating the filter expressions.
+ * Every time we get a match we immediately do a break and jump
+ * to the next level. We'll return FALSE if we arrive to a level
+ * without matches, TRUE otherwise.
+ */
+gboolean
+ephy_node_filter_evaluate (EphyNodeFilter *filter,
+ EphyNode *node)
+{
+ int i;
+
+ for (i = 0; i < filter->priv->levels->len; i++) {
+ GList *l, *list;
+ gboolean handled;
+
+ handled = FALSE;
+
+ list = g_ptr_array_index (filter->priv->levels, i);
+
+ for (l = list; l != NULL; l = g_list_next (l)) {
+ if (ephy_node_filter_expression_evaluate (l->data, node) == TRUE) {
+ handled = TRUE;
+ break;
+ }
+ }
+
+ if (handled == FALSE)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+EphyNodeFilterExpression *
+ephy_node_filter_expression_new (EphyNodeFilterExpressionType type,
+ ...)
+{
+ EphyNodeFilterExpression *exp;
+ va_list valist;
+
+ va_start (valist, type);
+
+ exp = g_new0 (EphyNodeFilterExpression, 1);
+
+ exp->type = type;
+
+ switch (type)
+ {
+ case EPHY_NODE_FILTER_EXPRESSION_NODE_EQUALS:
+ exp->args.node_args.a = va_arg (valist, EphyNode *);
+ exp->args.node_args.b = va_arg (valist, EphyNode *);
+ break;
+ case EPHY_NODE_FILTER_EXPRESSION_EQUALS:
+ case EPHY_NODE_FILTER_EXPRESSION_HAS_PARENT:
+ case EPHY_NODE_FILTER_EXPRESSION_HAS_CHILD:
+ exp->args.node_args.a = va_arg (valist, EphyNode *);
+ break;
+ case EPHY_NODE_FILTER_EXPRESSION_NODE_PROP_EQUALS:
+ case EPHY_NODE_FILTER_EXPRESSION_CHILD_PROP_EQUALS:
+ exp->args.prop_args.prop_id = va_arg (valist, int);
+ exp->args.prop_args.second_arg.node = va_arg (valist, EphyNode *);
+ break;
+ case EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_CONTAINS:
+ case EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_EQUALS:
+ exp->args.prop_args.prop_id = va_arg (valist, int);
+ exp->args.prop_args.second_arg.string = g_utf8_casefold (va_arg (valist, char *), -1);
+ break;
+ case EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_CONTAINS:
+ case EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_EQUALS:
+ {
+ char *folded;
+
+ exp->args.prop_args.prop_id = va_arg (valist, int);
+
+ folded = g_utf8_casefold (va_arg (valist, char *), -1);
+ exp->args.prop_args.second_arg.string = g_utf8_collate_key (folded, -1);
+ g_free (folded);
+ break;
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_INT_PROP_EQUALS:
+ case EPHY_NODE_FILTER_EXPRESSION_INT_PROP_BIGGER_THAN:
+ case EPHY_NODE_FILTER_EXPRESSION_INT_PROP_LESS_THAN:
+ exp->args.prop_args.prop_id = va_arg (valist, int);
+ exp->args.prop_args.second_arg.number = va_arg (valist, int);
+ break;
+ default:
+ break;
+ }
+
+ va_end (valist);
+
+ return exp;
+}
+
+void
+ephy_node_filter_expression_free (EphyNodeFilterExpression *exp)
+{
+ switch (exp->type)
+ {
+ case EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_CONTAINS:
+ case EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_EQUALS:
+ case EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_CONTAINS:
+ case EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_EQUALS:
+ g_free (exp->args.prop_args.second_arg.string);
+ break;
+ default:
+ break;
+ }
+
+ g_free (exp);
+}
+
+static gboolean
+ephy_node_filter_expression_evaluate (EphyNodeFilterExpression *exp,
+ EphyNode *node)
+{
+ switch (exp->type)
+ {
+ case EPHY_NODE_FILTER_EXPRESSION_ALWAYS_TRUE:
+ return TRUE;
+ case EPHY_NODE_FILTER_EXPRESSION_NODE_EQUALS:
+ return (exp->args.node_args.a == exp->args.node_args.b);
+ case EPHY_NODE_FILTER_EXPRESSION_EQUALS:
+ return (exp->args.node_args.a == node);
+ case EPHY_NODE_FILTER_EXPRESSION_HAS_PARENT:
+ return ephy_node_has_child (exp->args.node_args.a, node);
+ case EPHY_NODE_FILTER_EXPRESSION_HAS_CHILD:
+ return ephy_node_has_child (node, exp->args.node_args.a);
+ case EPHY_NODE_FILTER_EXPRESSION_NODE_PROP_EQUALS:
+ {
+ EphyNode *prop;
+
+ prop = ephy_node_get_property_node (node,
+ exp->args.prop_args.prop_id);
+
+ return (prop == exp->args.prop_args.second_arg.node);
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_CHILD_PROP_EQUALS:
+ {
+ EphyNode *prop;
+ GPtrArray *children;
+ int i;
+
+ children = ephy_node_get_children (node);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *child;
+
+ child = g_ptr_array_index (children, i);
+ prop = ephy_node_get_property_node
+ (child, exp->args.prop_args.prop_id);
+
+ if (prop == exp->args.prop_args.second_arg.node)
+ {
+ ephy_node_thaw (node);
+ return TRUE;
+ }
+ }
+
+ ephy_node_thaw (node);
+ return FALSE;
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_CONTAINS:
+ {
+ const char *prop;
+ char *folded_case;
+ gboolean ret;
+
+ prop = ephy_node_get_property_string (node,
+ exp->args.prop_args.prop_id);
+ if (prop == NULL)
+ return FALSE;
+
+ folded_case = g_utf8_casefold (prop, -1);
+ ret = (strstr (folded_case, exp->args.prop_args.second_arg.string) != NULL);
+ g_free (folded_case);
+
+ return ret;
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_EQUALS:
+ {
+ const char *prop;
+ char *folded_case;
+ gboolean ret;
+
+ prop = ephy_node_get_property_string (node,
+ exp->args.prop_args.prop_id);
+
+ if (prop == NULL)
+ return FALSE;
+
+ folded_case = g_utf8_casefold (prop, -1);
+ ret = (strcmp (folded_case, exp->args.prop_args.second_arg.string) == 0);
+ g_free (folded_case);
+
+ return ret;
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_CONTAINS:
+ {
+ const char *prop;
+
+ prop = ephy_node_get_property_string (node,
+ exp->args.prop_args.prop_id);
+
+ if (prop == NULL)
+ return FALSE;
+
+ return (strstr (prop, exp->args.prop_args.second_arg.string) != NULL);
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_EQUALS:
+ {
+ const char *prop;
+
+ prop = ephy_node_get_property_string (node,
+ exp->args.prop_args.prop_id);
+
+ if (prop == NULL)
+ return FALSE;
+
+ return (strcmp (prop, exp->args.prop_args.second_arg.string) == 0);
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_INT_PROP_EQUALS:
+ {
+ int prop;
+
+ prop = ephy_node_get_property_int (node,
+ exp->args.prop_args.prop_id);
+
+ return (prop == exp->args.prop_args.second_arg.number);
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_INT_PROP_BIGGER_THAN:
+ {
+ int prop;
+
+ prop = ephy_node_get_property_int (node,
+ exp->args.prop_args.prop_id);
+
+ return (prop > exp->args.prop_args.second_arg.number);
+ }
+ case EPHY_NODE_FILTER_EXPRESSION_INT_PROP_LESS_THAN:
+ {
+ int prop;
+
+ prop = ephy_node_get_property_int (node,
+ exp->args.prop_args.prop_id);
+ g_print ("%d %d\n", prop, exp->args.prop_args.second_arg.number);
+ return (prop < exp->args.prop_args.second_arg.number);
+ }
+ default:
+ break;
+ }
+
+ return FALSE;
+}
diff --git a/lib/ephy-node-filter.h b/lib/ephy-node-filter.h
new file mode 100644
index 000000000..1aedc16c6
--- /dev/null
+++ b/lib/ephy-node-filter.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2002 Olivier Martin <omartin@ifrance.com>
+ * (C) 2002 Jorn Baayen <jorn@nl.linux.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef EPHY_NODE_FILTER_H
+#define EPHY_NODE_FILTER_H
+
+#include <glib-object.h>
+
+#include "ephy-node.h"
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_NODE_FILTER (ephy_node_filter_get_type ())
+#define EPHY_NODE_FILTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_NODE_FILTER, EphyNodeFilter))
+#define EPHY_NODE_FILTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_NODE_FILTER, EphyNodeFilterClass))
+#define EPHY_IS_NODE_FILTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_NODE_FILTER))
+#define EPHY_IS_NODE_FILTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_NODE_FILTER))
+#define EPHY_NODE_FILTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_NODE_FILTER, EphyNodeFilterClass))
+
+typedef struct EphyNodeFilterPrivate EphyNodeFilterPrivate;
+
+typedef struct
+{
+ GObject parent;
+
+ EphyNodeFilterPrivate *priv;
+} EphyNodeFilter;
+
+typedef struct
+{
+ GObjectClass parent;
+
+ void (*changed) (EphyNodeFilter *filter);
+} EphyNodeFilterClass;
+
+typedef enum
+{
+ EPHY_NODE_FILTER_EXPRESSION_ALWAYS_TRUE, /* args: none */
+ EPHY_NODE_FILTER_EXPRESSION_NODE_EQUALS, /* args: EphyNode *a, EphyNode *b */
+ EPHY_NODE_FILTER_EXPRESSION_EQUALS, /* args: EphyNode *node */
+ EPHY_NODE_FILTER_EXPRESSION_HAS_PARENT, /* args: EphyNode *parent */
+ EPHY_NODE_FILTER_EXPRESSION_HAS_CHILD, /* args: EphyNode *child */
+ EPHY_NODE_FILTER_EXPRESSION_NODE_PROP_EQUALS, /* args: int prop_id, EphyNode *node */
+ EPHY_NODE_FILTER_EXPRESSION_CHILD_PROP_EQUALS, /* args: int prop_id, EphyNode *node */
+ EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_CONTAINS, /* args: int prop_id, const char *string */
+ EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_EQUALS, /* args: int prop_id, const char *string */
+ EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_CONTAINS, /* args: int prop_id, const char *string */
+ EPHY_NODE_FILTER_EXPRESSION_KEY_PROP_EQUALS, /* args: int prop_id, const char *string */
+ EPHY_NODE_FILTER_EXPRESSION_INT_PROP_EQUALS, /* args: int prop_id, int int */
+ EPHY_NODE_FILTER_EXPRESSION_INT_PROP_BIGGER_THAN, /* args: int prop_id, int int */
+ EPHY_NODE_FILTER_EXPRESSION_INT_PROP_LESS_THAN /* args: int prop_id, int int */
+} EphyNodeFilterExpressionType;
+
+typedef struct EphyNodeFilterExpression EphyNodeFilterExpression;
+
+/* The filter starts iterating over all expressions at level 0,
+ * if one of them is TRUE it continues to level 1, etc.
+ * If it still has TRUE when there are no more expressions at the
+ * next level, the result is TRUE. Otherwise, it's FALSE.
+ */
+
+GType ephy_node_filter_get_type (void);
+
+EphyNodeFilter *ephy_node_filter_new (void);
+
+void ephy_node_filter_add_expression (EphyNodeFilter *filter,
+ EphyNodeFilterExpression *expression,
+ int level);
+
+void ephy_node_filter_empty (EphyNodeFilter *filter);
+
+void ephy_node_filter_done_changing (EphyNodeFilter *filter);
+
+gboolean ephy_node_filter_evaluate (EphyNodeFilter *filter,
+ EphyNode *node);
+
+EphyNodeFilterExpression *ephy_node_filter_expression_new (EphyNodeFilterExpressionType,
+ ...);
+/* no need to free unless you didn't add the expression to a filter */
+void ephy_node_filter_expression_free (EphyNodeFilterExpression *expression);
+
+G_END_DECLS
+
+#endif /* EPHY_NODE_FILTER_H */
diff --git a/lib/ephy-node.c b/lib/ephy-node.c
new file mode 100644
index 000000000..b75df9349
--- /dev/null
+++ b/lib/ephy-node.c
@@ -0,0 +1,1439 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include <config.h>
+#include <libgnome/gnome-i18n.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <gdk/gdk.h>
+#include <time.h>
+
+#include "ephy-node.h"
+#include "ephy-string.h"
+#include "ephy-thread-helpers.h"
+
+static void ephy_node_class_init (EphyNodeClass *klass);
+static void ephy_node_init (EphyNode *node);
+static void ephy_node_finalize (GObject *object);
+static void ephy_node_dispose (GObject *object);
+static void ephy_node_set_object_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void ephy_node_get_object_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static inline void id_factory_set_to (gulong new_factory_pos);
+static inline void real_set_property (EphyNode *node,
+ guint property_id,
+ GValue *value);
+static inline void real_remove_child (EphyNode *node,
+ EphyNode *child,
+ gboolean remove_from_parent,
+ gboolean remove_from_child);
+static inline void real_add_child (EphyNode *node,
+ EphyNode *child);
+static inline void read_lock_to_write_lock (EphyNode *node);
+static inline void write_lock_to_read_lock (EphyNode *node);
+static inline void lock_gdk (void);
+static inline void unlock_gdk (void);
+static inline EphyNode *node_from_id_real (gulong id);
+static inline int get_child_index_real (EphyNode *node,
+ EphyNode *child);
+
+typedef struct
+{
+ EphyNode *node;
+ guint index;
+} EphyNodeParent;
+
+struct EphyNodePrivate
+{
+ GStaticRWLock *lock;
+
+ int ref_count;
+
+ gulong id;
+
+ GPtrArray *properties;
+
+ GHashTable *parents;
+ GPtrArray *children;
+};
+
+enum
+{
+ PROP_0,
+ PROP_ID
+};
+
+enum
+{
+ DESTROYED,
+ RESTORED,
+ CHILD_ADDED,
+ CHILD_CHANGED,
+ CHILD_REMOVED,
+ LAST_SIGNAL
+};
+
+static GObjectClass *parent_class = NULL;
+
+static guint ephy_node_signals[LAST_SIGNAL] = { 0 };
+
+static GMutex *id_factory_lock = NULL;
+static long id_factory = 0;
+
+static GStaticRWLock *id_to_node_lock = NULL;
+static GPtrArray *id_to_node;
+
+GType
+ephy_node_get_type (void)
+{
+ static GType ephy_node_type = 0;
+
+ if (ephy_node_type == 0) {
+ static const GTypeInfo our_info = {
+ sizeof (EphyNodeClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) ephy_node_class_init,
+ NULL,
+ NULL,
+ sizeof (EphyNode),
+ 0,
+ (GInstanceInitFunc) ephy_node_init
+ };
+
+ ephy_node_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyNode",
+ &our_info, 0);
+ }
+
+ return ephy_node_type;
+}
+
+static void
+ephy_node_class_init (EphyNodeClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_node_finalize;
+ object_class->dispose = ephy_node_dispose;
+
+ object_class->set_property = ephy_node_set_object_property;
+ object_class->get_property = ephy_node_get_object_property;
+
+ g_object_class_install_property (object_class,
+ PROP_ID,
+ g_param_spec_long ("id",
+ "Node ID",
+ "Node ID",
+ 0, G_MAXLONG, 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ ephy_node_signals[DESTROYED] =
+ g_signal_new ("destroyed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyNodeClass, destroyed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ ephy_node_signals[RESTORED] =
+ g_signal_new ("restored",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyNodeClass, restored),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ ephy_node_signals[CHILD_ADDED] =
+ g_signal_new ("child_added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyNodeClass, child_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ EPHY_TYPE_NODE);
+ ephy_node_signals[CHILD_CHANGED] =
+ g_signal_new ("child_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyNodeClass, child_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ EPHY_TYPE_NODE);
+ ephy_node_signals[CHILD_REMOVED] =
+ g_signal_new ("child_removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyNodeClass, child_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ EPHY_TYPE_NODE);
+}
+
+static gboolean
+int_equal (gconstpointer a,
+ gconstpointer b)
+{
+ return GPOINTER_TO_INT (a) == GPOINTER_TO_INT (b);
+}
+
+static guint
+int_hash (gconstpointer a)
+{
+ return GPOINTER_TO_INT (a);
+}
+
+static void
+ephy_node_init (EphyNode *node)
+{
+ node->priv = g_new0 (EphyNodePrivate, 1);
+
+ node->priv->lock = g_new0 (GStaticRWLock, 1);
+ g_static_rw_lock_init (node->priv->lock);
+
+ node->priv->ref_count = 0;
+
+ node->priv->id = -1;
+
+ node->priv->properties = g_ptr_array_new ();
+
+ node->priv->parents = g_hash_table_new_full (int_hash,
+ int_equal,
+ NULL,
+ g_free);
+
+ node->priv->children = g_ptr_array_new ();
+}
+
+static void
+ephy_node_finalize (GObject *object)
+{
+ EphyNode *node;
+ guint i;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (EPHY_IS_NODE (object));
+
+ node = EPHY_NODE (object);
+
+ g_return_if_fail (node->priv != NULL);
+
+ for (i = 0; i < node->priv->properties->len; i++) {
+ GValue *val;
+
+ val = g_ptr_array_index (node->priv->properties, i);
+
+ if (val != NULL) {
+ g_value_unset (val);
+ g_free (val);
+ }
+ }
+ g_ptr_array_free (node->priv->properties, FALSE);
+
+ g_hash_table_destroy (node->priv->parents);
+
+ g_ptr_array_free (node->priv->children, FALSE);
+
+ g_static_rw_lock_free (node->priv->lock);
+
+ g_free (node->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+remove_child (long id,
+ EphyNodeParent *node_info,
+ EphyNode *node)
+{
+ g_static_rw_lock_writer_lock (node_info->node->priv->lock);
+
+ real_remove_child (node_info->node, node, TRUE, FALSE);
+
+ g_static_rw_lock_writer_unlock (node_info->node->priv->lock);
+}
+
+static void
+ephy_node_dispose (GObject *object)
+{
+ EphyNode *node;
+ guint i;
+
+ node = EPHY_NODE (object);
+
+ /* remove from id table */
+ g_static_rw_lock_writer_lock (id_to_node_lock);
+
+ g_ptr_array_index (id_to_node, node->priv->id) = NULL;
+
+ g_static_rw_lock_writer_unlock (id_to_node_lock);
+
+ lock_gdk ();
+
+ /* remove from DAG */
+ g_hash_table_foreach (node->priv->parents,
+ (GHFunc) remove_child,
+ node);
+
+ for (i = 0; i < node->priv->children->len; i++) {
+ EphyNode *child;
+
+ child = g_ptr_array_index (node->priv->children, i);
+
+ g_static_rw_lock_writer_lock (child->priv->lock);
+
+ real_remove_child (node, child, FALSE, TRUE);
+
+ g_static_rw_lock_writer_unlock (child->priv->lock);
+ }
+
+ g_static_rw_lock_writer_unlock (node->priv->lock);
+
+ g_signal_emit (G_OBJECT (node), ephy_node_signals[DESTROYED], 0);
+
+ unlock_gdk ();
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+ephy_node_set_object_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyNode *node = EPHY_NODE (object);
+
+ switch (prop_id)
+ {
+ case PROP_ID:
+ node->priv->id = g_value_get_long (value);
+
+ g_static_rw_lock_writer_lock (id_to_node_lock);
+
+ /* resize array if needed */
+ if (node->priv->id >= id_to_node->len)
+ g_ptr_array_set_size (id_to_node, node->priv->id + 1);
+
+ g_ptr_array_index (id_to_node, node->priv->id) = node;
+
+ g_static_rw_lock_writer_unlock (id_to_node_lock);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+ephy_node_get_object_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyNode *node = EPHY_NODE (object);
+
+ switch (prop_id)
+ {
+ case PROP_ID:
+ g_value_set_long (value, node->priv->id);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+EphyNode *
+ephy_node_new (void)
+{
+ EphyNode *node;
+
+ node = EPHY_NODE (g_object_new (EPHY_TYPE_NODE,
+ "id", ephy_node_new_id (),
+ NULL));
+
+ g_return_val_if_fail (node->priv != NULL, NULL);
+
+ return node;
+}
+
+long
+ephy_node_get_id (EphyNode *node)
+{
+ long ret;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), -1);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ ret = node->priv->id;
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return ret;
+}
+
+static inline EphyNode *
+node_from_id_real (gulong id)
+{
+ EphyNode *ret = NULL;
+
+ if (id < id_to_node->len)
+ ret = g_ptr_array_index (id_to_node, id);;
+
+ return ret;
+}
+
+EphyNode *
+ephy_node_get_from_id (gulong id)
+{
+ EphyNode *ret = NULL;
+
+ g_return_val_if_fail (id > 0, NULL);
+
+ g_static_rw_lock_reader_lock (id_to_node_lock);
+
+ ret = node_from_id_real (id);
+
+ g_static_rw_lock_reader_unlock (id_to_node_lock);
+
+ return ret;
+}
+
+void
+ephy_node_ref (EphyNode *node)
+{
+ g_return_if_fail (EPHY_IS_NODE (node));
+
+ g_static_rw_lock_writer_lock (node->priv->lock);
+
+ node->priv->ref_count++;
+
+ g_static_rw_lock_writer_unlock (node->priv->lock);
+}
+
+void
+ephy_node_unref (EphyNode *node)
+{
+ g_return_if_fail (EPHY_IS_NODE (node));
+
+ g_static_rw_lock_writer_lock (node->priv->lock);
+
+ node->priv->ref_count--;
+
+ if (node->priv->ref_count <= 0) {
+ g_object_unref (G_OBJECT (node));
+ } else {
+ g_static_rw_lock_writer_unlock (node->priv->lock);
+ }
+}
+
+void
+ephy_node_freeze (EphyNode *node)
+{
+ g_return_if_fail (EPHY_IS_NODE (node));
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+}
+
+void
+ephy_node_thaw (EphyNode *node)
+{
+ g_return_if_fail (EPHY_IS_NODE (node));
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+}
+
+static void
+child_changed (gulong id,
+ EphyNodeParent *node_info,
+ EphyNode *node)
+{
+ g_static_rw_lock_reader_lock (node_info->node->priv->lock);
+
+ g_signal_emit (G_OBJECT (node_info->node), ephy_node_signals[CHILD_CHANGED], 0, node);
+
+ g_static_rw_lock_reader_unlock (node_info->node->priv->lock);
+}
+
+static inline void
+real_set_property (EphyNode *node,
+ guint property_id,
+ GValue *value)
+{
+ GValue *old;
+
+ if (property_id >= node->priv->properties->len) {
+ g_ptr_array_set_size (node->priv->properties, property_id + 1);
+ }
+
+ old = g_ptr_array_index (node->priv->properties, property_id);
+ if (old != NULL) {
+ g_value_unset (old);
+ g_free (old);
+ }
+
+ g_ptr_array_index (node->priv->properties, property_id) = value;
+}
+
+void
+ephy_node_set_property (EphyNode *node,
+ guint property_id,
+ const GValue *value)
+{
+ GValue *new;
+
+ g_return_if_fail (EPHY_IS_NODE (node));
+ g_return_if_fail (property_id >= 0);
+ g_return_if_fail (value != NULL);
+
+ lock_gdk ();
+
+ g_static_rw_lock_writer_lock (node->priv->lock);
+
+ new = g_new0 (GValue, 1);
+ g_value_init (new, G_VALUE_TYPE (value));
+ g_value_copy (value, new);
+
+ real_set_property (node, property_id, new);
+
+ write_lock_to_read_lock (node);
+
+ g_hash_table_foreach (node->priv->parents,
+ (GHFunc) child_changed,
+ node);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ unlock_gdk ();
+}
+
+gboolean
+ephy_node_get_property (EphyNode *node,
+ guint property_id,
+ GValue *value)
+{
+ GValue *ret;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), FALSE);
+ g_return_val_if_fail (property_id >= 0, FALSE);
+ g_return_val_if_fail (value != NULL, FALSE);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return FALSE;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return FALSE;
+ }
+
+ g_value_init (value, G_VALUE_TYPE (ret));
+ g_value_copy (ret, value);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return TRUE;
+}
+
+const char *
+ephy_node_get_property_string (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ const char *retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), NULL);
+ g_return_val_if_fail (property_id >= 0, NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return NULL;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return NULL;
+ }
+
+ retval = g_value_get_string (ret);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+gboolean
+ephy_node_get_property_boolean (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ gboolean retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), FALSE);
+ g_return_val_if_fail (property_id >= 0, FALSE);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return FALSE;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return FALSE;
+ }
+
+ retval = g_value_get_boolean (ret);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+long
+ephy_node_get_property_long (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ long retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), -1);
+ g_return_val_if_fail (property_id >= 0, -1);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ retval = g_value_get_long (ret);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+int
+ephy_node_get_property_int (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ int retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), -1);
+ g_return_val_if_fail (property_id >= 0, -1);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ retval = g_value_get_int (ret);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+double
+ephy_node_get_property_double (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ double retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), -1);
+ g_return_val_if_fail (property_id >= 0, -1);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ retval = g_value_get_double (ret);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+float
+ephy_node_get_property_float (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ float retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), -1);
+ g_return_val_if_fail (property_id >= 0, -1);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return -1;
+ }
+
+ retval = g_value_get_float (ret);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+EphyNode *
+ephy_node_get_property_node (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ EphyNode *retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), NULL);
+ g_return_val_if_fail (property_id >= 0, NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return NULL;
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return NULL;
+ }
+
+ retval = g_value_get_pointer (ret);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+char *
+ephy_node_get_property_time (EphyNode *node,
+ guint property_id)
+{
+ GValue *ret;
+ long mtime;
+ char *retval;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), NULL);
+ g_return_val_if_fail (property_id >= 0, NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (property_id >= node->priv->properties->len) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return g_strdup (_("Never"));
+ }
+
+ ret = g_ptr_array_index (node->priv->properties, property_id);
+ if (ret == NULL) {
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ return g_strdup (_("Never"));
+ }
+
+ mtime = g_value_get_long (ret);
+
+ if (retval >= 0) {
+ GDate *now, *file_date;
+ guint32 file_date_age;
+ const char *format = NULL;
+
+ now = g_date_new ();
+ g_date_set_time (now, time (NULL));
+
+ file_date = g_date_new ();
+ g_date_set_time (file_date, mtime);
+
+ file_date_age = (g_date_get_julian (now) - g_date_get_julian (file_date));
+
+ g_date_free (file_date);
+ g_date_free (now);
+
+ if (file_date_age == 0) {
+ format = _("Today at %-H:%M");
+ } else if (file_date_age == 1) {
+ format = _("Yesterday at %-H:%M");
+ } else {
+ format = _("%A, %B %-d %Y at %-H:%M");
+ }
+
+ retval = ephy_string_time_to_string (file_date, format);
+ } else {
+ retval = g_strdup (_("Never"));
+ }
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return retval;
+}
+
+static void
+save_parent (gulong id,
+ EphyNodeParent *node_info,
+ xmlNodePtr xml_node)
+{
+ xmlNodePtr parent_xml_node;
+ char *xml;
+
+ parent_xml_node = xmlNewChild (xml_node, NULL, "parent", NULL);
+
+ g_static_rw_lock_reader_lock (node_info->node->priv->lock);
+
+ xml = g_strdup_printf ("%ld", node_info->node->priv->id);
+ xmlSetProp (parent_xml_node, "id", xml);
+ g_free (xml);
+
+ g_static_rw_lock_reader_unlock (node_info->node->priv->lock);
+}
+
+void
+ephy_node_save_to_xml (EphyNode *node,
+ xmlNodePtr parent_xml_node)
+{
+ xmlNodePtr xml_node;
+ char *xml;
+ guint i;
+
+ g_return_if_fail (EPHY_IS_NODE (node));
+ g_return_if_fail (parent_xml_node != NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ xml_node = xmlNewChild (parent_xml_node, NULL, "node", NULL);
+
+ xml = g_strdup_printf ("%ld", node->priv->id);
+ xmlSetProp (xml_node, "id", xml);
+ g_free (xml);
+
+ xmlSetProp (xml_node, "type", G_OBJECT_TYPE_NAME (node));
+
+ for (i = 0; i < node->priv->properties->len; i++) {
+ GValue *value;
+ xmlNodePtr value_xml_node;
+
+ value = g_ptr_array_index (node->priv->properties, i);
+ if (value == NULL)
+ continue;
+
+ value_xml_node = xmlNewChild (xml_node, NULL, "property", NULL);
+
+ xml = g_strdup_printf ("%d", i);
+ xmlSetProp (value_xml_node, "id", xml);
+ g_free (xml);
+
+ xmlSetProp (value_xml_node, "value_type", g_type_name (G_VALUE_TYPE (value)));
+
+ switch (G_VALUE_TYPE (value))
+ {
+ case G_TYPE_STRING:
+ xml = xmlEncodeEntitiesReentrant (NULL,
+ g_value_get_string (value));
+ xmlNodeSetContent (value_xml_node, xml);
+ g_free (xml);
+ break;
+ case G_TYPE_BOOLEAN:
+ xml = g_strdup_printf ("%d", g_value_get_boolean (value));
+ xmlNodeSetContent (value_xml_node, xml);
+ g_free (xml);
+ break;
+ case G_TYPE_INT:
+ xml = g_strdup_printf ("%d", g_value_get_int (value));
+ xmlNodeSetContent (value_xml_node, xml);
+ g_free (xml);
+ break;
+ case G_TYPE_LONG:
+ xml = g_strdup_printf ("%ld", g_value_get_long (value));
+ xmlNodeSetContent (value_xml_node, xml);
+ g_free (xml);
+ break;
+ case G_TYPE_FLOAT:
+ xml = g_strdup_printf ("%f", g_value_get_float (value));
+ xmlNodeSetContent (value_xml_node, xml);
+ g_free (xml);
+ break;
+ case G_TYPE_DOUBLE:
+ xml = g_strdup_printf ("%f", g_value_get_double (value));
+ xmlNodeSetContent (value_xml_node, xml);
+ g_free (xml);
+ break;
+ case G_TYPE_POINTER:
+ {
+ EphyNode *prop_node;
+
+ prop_node = g_value_get_pointer (value);
+
+ g_assert (prop_node != NULL);
+
+ g_static_rw_lock_reader_lock (prop_node->priv->lock);
+
+ xml = g_strdup_printf ("%ld", prop_node->priv->id);
+ xmlNodeSetContent (value_xml_node, xml);
+ g_free (xml);
+
+ g_static_rw_lock_reader_unlock (prop_node->priv->lock);
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ }
+
+ g_hash_table_foreach (node->priv->parents,
+ (GHFunc) save_parent,
+ xml_node);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+}
+
+/* this function assumes it's safe to not lock anything while loading,
+ * this is at least true for the case where we're loading the library xml file
+ * from the main loop */
+EphyNode *
+ephy_node_new_from_xml (xmlNodePtr xml_node)
+{
+ EphyNode *node;
+ xmlNodePtr xml_child;
+ char *xml;
+ long id;
+ GType type;
+
+ g_return_val_if_fail (xml_node != NULL, NULL);
+
+ xml = xmlGetProp (xml_node, "id");
+ if (xml == NULL)
+ return NULL;
+ id = atol (xml);
+ g_free (xml);
+
+ id_factory_set_to (id);
+
+ xml = xmlGetProp (xml_node, "type");
+ type = g_type_from_name (xml);
+ g_free (xml);
+
+ node = EPHY_NODE (g_object_new (type,
+ "id", id,
+ NULL));
+
+ g_return_val_if_fail (node->priv != NULL, NULL);
+
+ for (xml_child = xml_node->children; xml_child != NULL; xml_child = xml_child->next) {
+ if (strcmp (xml_child->name, "parent") == 0) {
+ EphyNode *parent;
+ long parent_id;
+
+ xml = xmlGetProp (xml_child, "id");
+ g_assert (xml != NULL);
+ parent_id = atol (xml);
+ g_free (xml);
+
+ parent = node_from_id_real (parent_id);
+
+ if (parent != NULL)
+ {
+ real_add_child (parent, node);
+
+ g_signal_emit (G_OBJECT (parent), ephy_node_signals[CHILD_ADDED],
+ 0, node);
+ }
+ } else if (strcmp (xml_child->name, "property") == 0) {
+ GType value_type;
+ GValue *value;
+ int property_id;
+
+ xml = xmlGetProp (xml_child, "id");
+ property_id = atoi (xml);
+ g_free (xml);
+
+ xml = xmlGetProp (xml_child, "value_type");
+ value_type = g_type_from_name (xml);
+ g_free (xml);
+
+ xml = xmlNodeGetContent (xml_child);
+ value = g_new0 (GValue, 1);
+ g_value_init (value, value_type);
+
+ switch (value_type)
+ {
+ case G_TYPE_STRING:
+ g_value_set_string (value, xml);
+ break;
+ case G_TYPE_INT:
+ g_value_set_int (value, atoi (xml));
+ break;
+ case G_TYPE_BOOLEAN:
+ g_value_set_boolean (value, atoi (xml));
+ break;
+ case G_TYPE_LONG:
+ g_value_set_long (value, atol (xml));
+ break;
+ case G_TYPE_FLOAT:
+ g_value_set_float (value, atof (xml));
+ break;
+ case G_TYPE_DOUBLE:
+ g_value_set_double (value, atof (xml));
+ break;
+ case G_TYPE_POINTER:
+ {
+ EphyNode *property_node;
+
+ property_node = node_from_id_real (atol (xml));
+
+ g_value_set_pointer (value, property_node);
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ real_set_property (node, property_id, value);
+
+ g_free (xml);
+ }
+ }
+
+ g_signal_emit (G_OBJECT (node), ephy_node_signals[RESTORED], 0);
+
+ return node;
+}
+
+static inline void
+real_add_child (EphyNode *node,
+ EphyNode *child)
+{
+ EphyNodeParent *node_info;
+
+ if (g_hash_table_lookup (child->priv->parents,
+ GINT_TO_POINTER (node->priv->id)) != NULL) {
+ return;
+ }
+
+ g_ptr_array_add (node->priv->children, child);
+
+ node_info = g_new0 (EphyNodeParent, 1);
+ node_info->node = node;
+ node_info->index = node->priv->children->len - 1;
+
+ g_hash_table_insert (child->priv->parents,
+ GINT_TO_POINTER (node->priv->id),
+ node_info);
+}
+
+void
+ephy_node_add_child (EphyNode *node,
+ EphyNode *child)
+{
+ g_return_if_fail (EPHY_IS_NODE (node));
+ g_return_if_fail (EPHY_IS_NODE (child));
+
+ lock_gdk ();
+
+ g_static_rw_lock_writer_lock (node->priv->lock);
+ g_static_rw_lock_writer_lock (child->priv->lock);
+
+ real_add_child (node, child);
+
+ write_lock_to_read_lock (node);
+ write_lock_to_read_lock (child);
+
+ g_signal_emit (G_OBJECT (node), ephy_node_signals[CHILD_ADDED], 0, child);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ g_static_rw_lock_reader_unlock (child->priv->lock);
+
+ unlock_gdk ();
+}
+
+static inline void
+real_remove_child (EphyNode *node,
+ EphyNode *child,
+ gboolean remove_from_parent,
+ gboolean remove_from_child)
+{
+ EphyNodeParent *node_info;
+
+ write_lock_to_read_lock (node);
+ write_lock_to_read_lock (child);
+
+ g_signal_emit (G_OBJECT (node), ephy_node_signals[CHILD_REMOVED], 0, child);
+
+ read_lock_to_write_lock (node);
+ read_lock_to_write_lock (child);
+
+ node_info = g_hash_table_lookup (child->priv->parents,
+ GINT_TO_POINTER (node->priv->id));
+
+ if (remove_from_parent) {
+ guint i;
+
+ g_ptr_array_remove_index (node->priv->children,
+ node_info->index);
+
+ /* correct indices on kids */
+ for (i = node_info->index; i < node->priv->children->len; i++) {
+ EphyNode *borked_node;
+ EphyNodeParent *borked_node_info;
+
+ borked_node = g_ptr_array_index (node->priv->children, i);
+
+ g_static_rw_lock_writer_lock (borked_node->priv->lock);
+
+ borked_node_info = g_hash_table_lookup (borked_node->priv->parents,
+ GINT_TO_POINTER (node->priv->id));
+ borked_node_info->index--;
+
+ g_static_rw_lock_writer_unlock (borked_node->priv->lock);
+ }
+ }
+
+ if (remove_from_child) {
+ g_hash_table_remove (child->priv->parents,
+ GINT_TO_POINTER (node->priv->id));
+ }
+}
+
+void
+ephy_node_remove_child (EphyNode *node,
+ EphyNode *child)
+{
+ g_return_if_fail (EPHY_IS_NODE (node));
+ g_return_if_fail (EPHY_IS_NODE (child));
+
+ lock_gdk ();
+
+ g_static_rw_lock_writer_lock (node->priv->lock);
+ g_static_rw_lock_writer_lock (child->priv->lock);
+
+ real_remove_child (node, child, TRUE, TRUE);
+
+ g_static_rw_lock_writer_unlock (node->priv->lock);
+ g_static_rw_lock_writer_unlock (child->priv->lock);
+
+ unlock_gdk ();
+}
+
+gboolean
+ephy_node_has_child (EphyNode *node,
+ EphyNode *child)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), FALSE);
+ g_return_val_if_fail (EPHY_IS_NODE (child), FALSE);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+ g_static_rw_lock_reader_lock (child->priv->lock);
+
+ ret = (g_hash_table_lookup (child->priv->parents,
+ GINT_TO_POINTER (node->priv->id)) != NULL);
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ g_static_rw_lock_reader_unlock (child->priv->lock);
+
+ return ret;
+}
+
+GPtrArray *
+ephy_node_get_children (EphyNode *node)
+{
+ g_return_val_if_fail (EPHY_IS_NODE (node), NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ return node->priv->children;
+}
+
+int
+ephy_node_get_n_children (EphyNode *node)
+{
+ int ret;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), -1);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ ret = node->priv->children->len;
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return ret;
+}
+
+EphyNode *
+ephy_node_get_nth_child (EphyNode *node,
+ guint n)
+{
+ EphyNode *ret;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), NULL);
+ g_return_val_if_fail (n >= 0, NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+
+ if (n < node->priv->children->len) {
+ ret = g_ptr_array_index (node->priv->children, n);
+ } else {
+ ret = NULL;
+ }
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+
+ return ret;
+}
+
+static inline int
+get_child_index_real (EphyNode *node,
+ EphyNode *child)
+{
+ EphyNodeParent *node_info;
+
+ node_info = g_hash_table_lookup (child->priv->parents,
+ GINT_TO_POINTER (node->priv->id));
+
+ if (node_info == NULL)
+ return -1;
+
+ return node_info->index;
+}
+
+int
+ephy_node_get_child_index (EphyNode *node,
+ EphyNode *child)
+{
+ EphyNodeParent *node_info;
+ int ret;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), -1);
+ g_return_val_if_fail (EPHY_IS_NODE (child), -1);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+ g_static_rw_lock_reader_lock (child->priv->lock);
+
+ node_info = g_hash_table_lookup (child->priv->parents,
+ GINT_TO_POINTER (node->priv->id));
+
+ if (node_info == NULL)
+ return -1;
+
+ ret = node_info->index;
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ g_static_rw_lock_reader_unlock (child->priv->lock);
+
+ return ret;
+}
+
+EphyNode *
+ephy_node_get_next_child (EphyNode *node,
+ EphyNode *child)
+{
+ EphyNode *ret;
+ guint idx;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), NULL);
+ g_return_val_if_fail (EPHY_IS_NODE (child), NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+ g_static_rw_lock_reader_lock (child->priv->lock);
+
+ idx = get_child_index_real (node, child);
+
+ if ((idx + 1) < node->priv->children->len) {
+ ret = g_ptr_array_index (node->priv->children, idx + 1);
+ } else {
+ ret = NULL;
+ }
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ g_static_rw_lock_reader_unlock (child->priv->lock);
+
+ return ret;
+}
+
+EphyNode *
+ephy_node_get_previous_child (EphyNode *node,
+ EphyNode *child)
+{
+ EphyNode *ret;
+ int idx;
+
+ g_return_val_if_fail (EPHY_IS_NODE (node), NULL);
+ g_return_val_if_fail (EPHY_IS_NODE (child), NULL);
+
+ g_static_rw_lock_reader_lock (node->priv->lock);
+ g_static_rw_lock_reader_lock (child->priv->lock);
+
+ idx = get_child_index_real (node, child);
+
+ if ((idx - 1) >= 0) {
+ ret = g_ptr_array_index (node->priv->children, idx - 1);
+ } else {
+ ret = NULL;
+ }
+
+ g_static_rw_lock_reader_unlock (node->priv->lock);
+ g_static_rw_lock_reader_unlock (child->priv->lock);
+
+ return ret;
+}
+
+void
+ephy_node_system_init (void)
+{
+ /* id to node */
+ id_to_node = g_ptr_array_new ();
+
+ id_to_node_lock = g_new0 (GStaticRWLock, 1);
+ g_static_rw_lock_init (id_to_node_lock);
+
+ /* id factory */
+ id_factory = 0;
+ id_factory_lock = g_mutex_new ();
+}
+
+void
+ephy_node_system_shutdown (void)
+{
+ g_ptr_array_free (id_to_node, FALSE);
+
+ g_static_rw_lock_free (id_to_node_lock);
+
+ g_mutex_free (id_factory_lock);
+}
+
+long
+ephy_node_new_id (void)
+{
+ long ret;
+
+ g_mutex_lock (id_factory_lock);
+
+ id_factory++;
+
+ ret = id_factory;
+
+ g_mutex_unlock (id_factory_lock);
+
+ return ret;
+}
+
+static void
+id_factory_set_to (gulong new_factory_pos)
+{
+ id_factory = new_factory_pos + 1;
+}
+
+/* evillish hacks to temporarily readlock->writelock and v.v. */
+static inline void
+write_lock_to_read_lock (EphyNode *node)
+{
+ g_static_mutex_lock (&node->priv->lock->mutex);
+ node->priv->lock->read_counter++;
+ g_static_mutex_unlock (&node->priv->lock->mutex);
+
+ g_static_rw_lock_writer_unlock (node->priv->lock);
+}
+
+static inline void
+read_lock_to_write_lock (EphyNode *node)
+{
+ g_static_mutex_lock (&node->priv->lock->mutex);
+ node->priv->lock->read_counter--;
+ g_static_mutex_unlock (&node->priv->lock->mutex);
+
+ g_static_rw_lock_writer_lock (node->priv->lock);
+}
+
+static inline void
+lock_gdk (void)
+{
+ if (ephy_thread_helpers_in_main_thread () == FALSE)
+ GDK_THREADS_ENTER ();
+}
+
+static inline void
+unlock_gdk (void)
+{
+ if (ephy_thread_helpers_in_main_thread () == FALSE)
+ GDK_THREADS_LEAVE ();
+}
diff --git a/lib/ephy-node.h b/lib/ephy-node.h
new file mode 100644
index 000000000..2e5f92210
--- /dev/null
+++ b/lib/ephy-node.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef EPHY_NODE_H
+#define EPHY_NODE_H
+
+#include <glib-object.h>
+
+#include <libxml/tree.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_NODE (ephy_node_get_type ())
+#define EPHY_NODE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_NODE, EphyNode))
+#define EPHY_NODE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_NODE, EphyNodeClass))
+#define EPHY_IS_NODE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_NODE))
+#define EPHY_IS_NODE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_NODE))
+#define EPHY_NODE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_NODE, EphyNodeClass))
+
+typedef struct EphyNodePrivate EphyNodePrivate;
+
+typedef struct
+{
+ GObject parent;
+
+ EphyNodePrivate *priv;
+} EphyNode;
+
+typedef struct
+{
+ GObjectClass parent;
+
+ /* signals */
+ void (*destroyed) (EphyNode *node);
+ void (*restored) (EphyNode *node);
+
+ void (*child_added) (EphyNode *node, EphyNode *child);
+ void (*child_changed) (EphyNode *node, EphyNode *child);
+ void (*child_reordered) (EphyNode *node, EphyNode *child,
+ int old_index, int new_index);
+ void (*child_removed) (EphyNode *node, EphyNode *child);
+} EphyNodeClass;
+
+GType ephy_node_get_type (void);
+
+EphyNode *ephy_node_new (void);
+
+/* unique node ID */
+long ephy_node_get_id (EphyNode *node);
+
+EphyNode *ephy_node_get_from_id (gulong id);
+
+/* refcounting */
+void ephy_node_ref (EphyNode *node);
+void ephy_node_unref (EphyNode *node);
+
+/* locking */
+void ephy_node_freeze (EphyNode *node);
+void ephy_node_thaw (EphyNode *node);
+
+/* property interface */
+enum
+{
+ EPHY_NODE_PROP_NAME = 0,
+ EPHY_NODE_PROP_NAME_SORT_KEY = 1
+};
+
+void ephy_node_set_property (EphyNode *node,
+ guint property_id,
+ const GValue *value);
+gboolean ephy_node_get_property (EphyNode *node,
+ guint property_id,
+ GValue *value);
+
+const char *ephy_node_get_property_string (EphyNode *node,
+ guint property_id);
+gboolean ephy_node_get_property_boolean (EphyNode *node,
+ guint property_id);
+long ephy_node_get_property_long (EphyNode *node,
+ guint property_id);
+int ephy_node_get_property_int (EphyNode *node,
+ guint property_id);
+double ephy_node_get_property_double (EphyNode *node,
+ guint property_id);
+float ephy_node_get_property_float (EphyNode *node,
+ guint property_id);
+EphyNode *ephy_node_get_property_node (EphyNode *node,
+ guint property_id);
+/* free return value */
+char *ephy_node_get_property_time (EphyNode *node,
+ guint property_id);
+
+/* xml storage */
+void ephy_node_save_to_xml (EphyNode *node,
+ xmlNodePtr parent_xml_node);
+EphyNode *ephy_node_new_from_xml (xmlNodePtr xml_node);
+
+/* DAG structure */
+void ephy_node_add_child (EphyNode *node,
+ EphyNode *child);
+void ephy_node_remove_child (EphyNode *node,
+ EphyNode *child);
+gboolean ephy_node_has_child (EphyNode *node,
+ EphyNode *child);
+
+/* Note that ephy_node_get_children freezes the node; you'll have to thaw it when done.
+ * This is to prevent the data getting changed from another thread. */
+GPtrArray *ephy_node_get_children (EphyNode *node);
+int ephy_node_get_n_children (EphyNode *node);
+EphyNode *ephy_node_get_nth_child (EphyNode *node,
+ guint n);
+int ephy_node_get_child_index (EphyNode *node,
+ EphyNode *child);
+EphyNode *ephy_node_get_next_child (EphyNode *node,
+ EphyNode *child);
+EphyNode *ephy_node_get_previous_child (EphyNode *node,
+ EphyNode *child);
+
+/* node id services */
+void ephy_node_system_init (void);
+void ephy_node_system_shutdown (void);
+
+long ephy_node_new_id (void);
+
+G_END_DECLS
+
+#endif /* __EPHY_NODE_H */
diff --git a/lib/ephy-prefs-utils.c b/lib/ephy-prefs-utils.c
new file mode 100644
index 000000000..0e0cf4a50
--- /dev/null
+++ b/lib/ephy-prefs-utils.c
@@ -0,0 +1,285 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ephy-prefs-utils.h"
+#include "ephy-gui.h"
+#include "eel-gconf-extensions.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkmenushell.h>
+#include <gtk/gtkspinbutton.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkoptionmenu.h>
+#include <gtk/gtklist.h>
+#include <libgnomeui/gnome-color-picker.h>
+
+void
+ephy_pu_set_config_from_editable (GtkWidget *editable, const char *config_name)
+{
+ GConfValue *gcvalue = eel_gconf_get_value (config_name);
+ GConfValueType value_type;
+ char *value;
+ gint ivalue;
+ gfloat fvalue;
+
+ if (gcvalue == NULL) {
+ /* ugly hack around what appears to be a gconf bug
+ * it returns a NULL GConfValue for a valid string pref
+ * which is "" by default */
+ value_type = GCONF_VALUE_STRING;
+ } else {
+ value_type = gcvalue->type;
+ gconf_value_free (gcvalue);
+ }
+
+ /* get all the text into a new string */
+ value = gtk_editable_get_chars (GTK_EDITABLE(editable), 0, -1);
+
+ switch (value_type) {
+ case GCONF_VALUE_STRING:
+ eel_gconf_set_string (config_name,
+ value);
+ break;
+ /* FIXME : handle possible errors in the input for int and float */
+ case GCONF_VALUE_INT:
+ ivalue = atoi (value);
+ eel_gconf_set_integer (config_name, ivalue);
+ break;
+ case GCONF_VALUE_FLOAT:
+ fvalue = strtod (value, (char**)NULL);
+ eel_gconf_set_float (config_name, fvalue);
+ break;
+ default:
+ break;
+ }
+
+ /* free the allocated strings */
+ g_free (value);
+}
+
+void
+ephy_pu_set_config_from_optionmenu (GtkWidget *optionmenu, const char *config_name)
+{
+ int index = ephy_pu_get_int_from_optionmenu (optionmenu);
+
+ eel_gconf_set_integer (config_name, index);
+}
+
+void
+ephy_pu_set_config_from_radiobuttongroup (GtkWidget *radiobutton, const char *config_name)
+{
+ gint index;
+
+ /* get value from radio button group */
+ index = ephy_gui_gtk_radio_button_get (GTK_RADIO_BUTTON (radiobutton));
+
+ eel_gconf_set_integer (config_name, index);
+}
+
+void
+ephy_pu_set_config_from_spin_button (GtkWidget *spinbutton, const char *config_name)
+{
+ gdouble value;
+ gboolean use_int;
+
+ /* read the value as an integer */
+ value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spinbutton));
+
+ use_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(spinbutton)) == 0);
+
+ if (use_int)
+ {
+ eel_gconf_set_integer (config_name, value);
+ }
+ else
+ {
+ eel_gconf_set_float (config_name, value);
+ }
+}
+
+void
+ephy_pu_set_config_from_togglebutton (GtkWidget *togglebutton, const char *config_name)
+{
+ gboolean value;
+
+ /* read the value */
+ value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(togglebutton));
+
+ eel_gconf_set_boolean (config_name, value);
+}
+
+void
+ephy_pu_set_config_from_color (GtkWidget *colorpicker, const char *config_name)
+{
+ guint8 r, g, b, a;
+ gchar color_string[9];
+
+ /* get color values from color picker */
+ gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (colorpicker),
+ &r, &g, &b, &a);
+
+ /* write into string (bounded size) */
+ snprintf (color_string, 9, "#%02X%02X%02X", r, g, b);
+
+ /* set the configuration value */
+ eel_gconf_set_string (config_name, color_string);
+}
+
+void
+ephy_pu_set_editable_from_config (GtkWidget *editable, const char *config_name)
+{
+ GConfValue *gcvalue = eel_gconf_get_value (config_name);
+ GConfValueType value_type;
+ gchar *value;
+
+ if (gcvalue == NULL)
+ {
+ /* ugly hack around what appears to be a gconf bug
+ * it returns a NULL GConfValue for a valid string pref
+ * which is "" by default */
+ value_type = GCONF_VALUE_STRING;
+ }
+ else
+ {
+ value_type = gcvalue->type;
+ gconf_value_free (gcvalue);
+ }
+
+ switch (value_type)
+ {
+ case GCONF_VALUE_STRING:
+ value = eel_gconf_get_string (config_name);
+ break;
+ case GCONF_VALUE_INT:
+ value = g_strdup_printf ("%d",eel_gconf_get_integer (config_name));
+ break;
+ case GCONF_VALUE_FLOAT:
+ value = g_strdup_printf ("%.2f",eel_gconf_get_float (config_name));
+ break;
+ default:
+ value = NULL;
+ }
+
+ /* set this string value in the widget */
+ if (value)
+ {
+ gtk_entry_set_text(GTK_ENTRY(editable), value);
+ }
+
+ /* free the allocated string */
+ g_free (value);
+}
+
+void
+ephy_pu_set_optionmenu_from_config (GtkWidget *optionmenu, const char *config_name)
+{
+ gint index;
+
+ /* get the current value from the configuration space */
+ index = eel_gconf_get_integer (config_name);
+
+ /* set this option value in the widget */
+ gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), index);
+}
+
+void
+ephy_pu_set_radiobuttongroup_from_config (GtkWidget *radiobutton, const char *config_name)
+{
+ gint index;
+
+ /* get the current value from the configuration space */
+ index = eel_gconf_get_integer (config_name);
+
+ /* set it (finds the group for us) */
+ ephy_gui_gtk_radio_button_set (GTK_RADIO_BUTTON (radiobutton), index);
+}
+
+void
+ephy_pu_set_spin_button_from_config (GtkWidget *spinbutton, const char *config_name)
+{
+ gdouble value;
+ gint use_int;
+
+ use_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(spinbutton)) == 0);
+
+ if (use_int)
+ {
+ /* get the current value from the configuration space */
+ value = eel_gconf_get_integer (config_name);
+ }
+ else
+ {
+ /* get the current value from the configuration space */
+ value = eel_gconf_get_float (config_name);
+ }
+
+ /* set this option value in the widget */
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbutton), value);
+}
+
+void
+ephy_pu_set_togglebutton_from_config (GtkWidget *togglebutton, const char *config_name)
+{
+ gboolean value;
+
+ /* get the current value from the configuration space */
+ value = eel_gconf_get_boolean (config_name);
+
+ /* set this option value in the widget */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton), value);
+}
+
+void
+ephy_pu_set_color_from_config (GtkWidget *colorpicker, const char *config_name)
+{
+ gchar *color_string;
+ guint r, g, b;
+
+ /* get the string from config */
+ color_string = eel_gconf_get_string (config_name);
+
+ if (color_string)
+ {
+ /* parse it and setup the color picker */
+ sscanf (color_string, "#%2X%2X%2X", &r, &g, &b);
+ gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (colorpicker),
+ r, g, b, 0);
+ /* free the string */
+ g_free (color_string);
+ }
+}
+
+int
+ephy_pu_get_int_from_optionmenu (GtkWidget *optionmenu)
+{
+ GtkWidget *menu;
+ GList *list;
+ gpointer item;
+ gint index;
+
+ /* extract the selection */
+ menu = GTK_OPTION_MENU(optionmenu)->menu;
+ list = GTK_MENU_SHELL(menu)->children;
+ item = gtk_menu_get_active (GTK_MENU(menu));
+ index = g_list_index (list, item);
+
+ return index;
+}
diff --git a/lib/ephy-prefs-utils.h b/lib/ephy-prefs-utils.h
new file mode 100644
index 000000000..13ac1e4d7
--- /dev/null
+++ b/lib/ephy-prefs-utils.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2000 Marco Pesenti Gritti
+ *
+ * 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, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+void ephy_pu_set_config_from_editable (GtkWidget *editable,
+ const char *config_name);
+
+void ephy_pu_set_config_from_optionmenu (GtkWidget *optionmenu,
+ const char *config_name);
+
+void ephy_pu_set_config_from_radiobuttongroup (GtkWidget *radiobutton,
+ const char *config_name);
+
+void ephy_pu_set_config_from_spin_button (GtkWidget *spinbutton,
+ const char *config_name);
+
+void ephy_pu_set_config_from_togglebutton (GtkWidget *togglebutton,
+ const char *config_name);
+
+void ephy_pu_set_config_from_color (GtkWidget *colorpicker,
+ const char *config_name);
+
+void ephy_pu_set_editable_from_config (GtkWidget *editable,
+ const char *config_name);
+
+void ephy_pu_set_optionmenu_from_config (GtkWidget *optionmenu,
+ const char *config_name);