Commit ecbb0fa9 authored by Shaun McCance's avatar Shaun McCance

- Minor changes

* configure.in:
- Minor changes

* data/default.css:
- Some CSS changes

* data/Makefile.am:
* data/ui/yelp-ui.xml:
* data/ui/yelp.glade:
* src/Makefile.am:
* src/yelp-base.c:
* src/yelp-gecko-utils.cpp:
* src/yelp-gecko-utils.h:
* src/yelp-html-gecko.c:
* src/yelp-html.h:
* src/yelp-window.c:
- Added font preference and all the Gecko wonder that goes with
- Moved theme stuff to settings

* src/yelp-man-pager.c:
* src/yelp-toc-pager.c:
* src/yelp-window.c:
- Moved theme stuff to settings

* src/yelp-db-pager.c:
* src/yelp-pager.c:
* src/yelp-utils.c:
- Changed debug statements to use g_print
parent dca56f74
2004-10-18 Shaun McCance <shaunm@gnome.org>
* configure.in:
- Minor changes
* data/default.css:
- Some CSS changes
* data/Makefile.am:
* data/ui/yelp-ui.xml:
* data/ui/yelp.glade:
* src/Makefile.am:
* src/yelp-base.c:
* src/yelp-gecko-utils.cpp:
* src/yelp-gecko-utils.h:
* src/yelp-html-gecko.c:
* src/yelp-html.h:
* src/yelp-window.c:
- Added font preference and all the Gecko wonder that goes with
- Moved theme stuff to settings
* src/yelp-man-pager.c:
* src/yelp-toc-pager.c:
* src/yelp-window.c:
- Moved theme stuff to settings
* src/yelp-db-pager.c:
* src/yelp-pager.c:
* src/yelp-utils.c:
- Changed debug statements to use g_print
2004-10-12 Shaun McCance <shaunm@gnome.org>
* data/ui/yelp-ui.xml:
......
AC_INIT(src/yelp-main.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(yelp, 2.6.0)
AM_CONFIG_HEADER(config.h)
AM_SANITY_CHECK
AM_MAINTAINER_MODE
AC_PROG_INTLTOOL
AC_PATH_PROG(GCONFTOOL, gconftool-2)
AM_MAINTAINER_MODE
AM_GCONF_SOURCE_2
AC_PROG_CC
AC_PROG_CXX
......
SUBDIRS = icons ui
@INTLTOOL_XML_RULE@
@INTLTOOL_SCHEMAS_RULE@
cssdir = $(datadir)/yelp
tocdir = $(datadir)/yelp
schemasdir = $(GCONF_SCHEMA_FILE_DIR)
schemas_DATA = yelp.schemas
css_DATA = default.css
tocdir = $(datadir)/yelp
toc_DATA = toc.xml
EXTRA_DIST = \
default.css \
toc.xml.in \
toc.xml
cssdir = $(datadir)/yelp
css_DATA = default.css
EXTRA_DIST = \
yelp.schemas yelp.schemas.in \
toc.xml toc.xml.in \
default.css
if GCONF_SCHEMAS_INSTALL
install-data-local:
if test -z "$(DESTDIR)"; then \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/yelp.schemas ; \
fi
else
install-data-local:
endif
......@@ -2,20 +2,18 @@ h1 { font-size: 1.6em; font-weight: bold; }
h2 { font-size: 1.4em; font-weight: bold; }
h3 { font-size: 1.2em; font-weight: bold; }
body { margin: 0em; padding: 0em; }
div[class="body"] {
margin-left: 0.8em;
margin-right: 0.8em;
margin-bottom: 1.6em;
body {
padding-left: 8px;
padding-right: 12px;
}
p, div { margin: 0em; }
p + p, p + div, div + p, div + div { margin-top: 0.8em; }
dl { margin: 0em; }
ol { margin: 0em; }
ul { margin: 0em; }
ul li { padding-left: 0.4em; }
dd + dt { margin-top: 1.6em; }
dl { margin: 0px; }
ol { margin: 0px; }
ul { margin: 0px; }
ol li { padding-left: 12px; }
ul li { padding-left: 12px; }
li[class="menu-folder"] + li[class="menu-file"] { margin-top: 0.8em; }
......@@ -9,6 +9,8 @@
<menuitem action="Copy"/>
<separator/>
<menuitem action="Find"/>
<separator/>
<menuitem action="Preferences"/>
</menu>
<menu action="GoMenu">
<menuitem action="GoBack"/>
......
......@@ -447,4 +447,241 @@
</child>
</widget>
<widget class="GtkDialog" id="prefs_dialog">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Preferences</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">True</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox7">
<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_area7">
<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="focus_on_click">True</property>
<property name="response_id">-7</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="GtkVBox" id="vbox133">
<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="label1226">
<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="GtkAlignment" id="alignment11">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkCheckButton" id="use_system_fonts">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Use system fonts</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment12">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkTable" id="font_table">
<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="label1227">
<property name="visible">True</property>
<property name="label" translatable="yes">_Variable width:</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_font</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="label1228">
<property name="visible">True</property>
<property name="label" translatable="yes">_Fixed width:</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_font</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="GtkFontButton" id="variable_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_style">True</property>
<property name="show_size">True</property>
<property name="use_font">False</property>
<property name="use_size">False</property>
<property name="focus_on_click">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="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFontButton" id="fixed_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_style">True</property>
<property name="show_size">True</property>
<property name="use_font">False</property>
<property name="use_size">False</property>
<property name="focus_on_click">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="y_options"></property>
</packing>
</child>
</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>
......@@ -9,6 +9,7 @@ INCLUDES = \
-I$(MOZILLA_INCLUDE_ROOT) \
-I$(MOZILLA_INCLUDE_ROOT)/dom \
-I$(MOZILLA_INCLUDE_ROOT)/find \
-I$(MOZILLA_INCLUDE_ROOT)/pref \
-I$(MOZILLA_INCLUDE_ROOT)/webbrwsr \
-I$(MOZILLA_INCLUDE_ROOT)/string \
-include $(MOZILLA_INCLUDE_ROOT)/mozilla-config.h \
......@@ -63,7 +64,6 @@ test_pager_SOURCES = \
yelp-man-pager.c yelp-man-pager.h \
yelp-man-parser.c yelp-man-parser.h \
yelp-pager.c yelp-pager.h \
yelp-theme.c yelp-theme.h \
yelp-toc-pager.c yelp-toc-pager.h \
yelp-utils.c yelp-utils.h \
yelp-marshal-main.c test-pager.c
......@@ -88,8 +88,8 @@ yelp_SOURCES = \
yelp-man-pager.c yelp-man-pager.h \
yelp-man-parser.c yelp-man-parser.h \
yelp-pager.c yelp-pager.h \
yelp-settings.c yelp-settings.h \
yelp-toc-pager.c yelp-toc-pager.h \
yelp-theme.c yelp-theme.h \
yelp-window.c yelp-window.h \
yelp-uri.c yelp-uri.h \
yelp-utils.c yelp-utils.h \
......
......@@ -29,7 +29,7 @@
#include "yelp-cache.h"
#include "yelp-window.h"
#include "yelp-theme.h"
#include "yelp-settings.h"
#include "yelp-pager.h"
#include "yelp-toc-pager.h"
#include "yelp-base.h"
......@@ -110,7 +110,7 @@ yelp_base_init (YelpBase *base)
base->priv = priv;
yelp_cache_init ();
yelp_theme_init ();
yelp_settings_init ();
}
static void
......
......@@ -39,7 +39,7 @@
#include "yelp-error.h"
#include "yelp-db-pager.h"
#include "yelp-toc-pager.h"
#include "yelp-theme.h"
#include "yelp-settings.h"
#ifdef YELP_DEBUG
#define d(x) x
......@@ -55,8 +55,6 @@
#define BOOK_CHUNK_DEPTH 2
#define ARTICLE_CHUNK_DEPTH 1
#define d(x)
struct _YelpDBPagerPriv {
GtkTreeModel *sects;
......@@ -221,7 +219,7 @@ db_pager_process (YelpPager *pager)
gchar *db_chunk_basename, *db_chunk_basename_q;
const gchar *params[40];
d (printf ("db_pager_process\n"));
d (g_print ("db_pager_process\n"));
doc_info = yelp_pager_get_doc_info (pager);
......@@ -309,9 +307,9 @@ db_pager_process (YelpPager *pager)
params[i++] = p_doc_path;
*/
params[i++] = "color_gray_background";
params[i++] = yelp_theme_get_gray_background ();
params[i++] = yelp_settings_get_color (YELP_COLOR_GRAY_BACKGROUND);
params[i++] = "color_gray_border";
params[i++] = yelp_theme_get_gray_border ();
params[i++] = yelp_settings_get_color (YELP_COLOR_GRAY_BORDER);
params[i++] = "admon_graphics_path";
params[i++] = "\"file://" DATADIR "/yelp/icons/\"";
params[i++] = NULL;
......@@ -379,7 +377,7 @@ db_pager_process (YelpPager *pager)
static void
db_pager_error (YelpPager *pager)
{
d (printf ("db_pager_error\n"));
d (g_print ("db_pager_error\n"));
yelp_pager_set_state (pager, YELP_PAGER_STATE_ERROR);
yelp_toc_pager_unpause (yelp_toc_pager_get ());
}
......@@ -387,7 +385,7 @@ db_pager_error (YelpPager *pager)
static void
db_pager_cancel (YelpPager *pager)
{
d (printf ("db_pager_cancel\n"));
d (g_print ("db_pager_cancel\n"));
yelp_pager_set_state (pager, YELP_PAGER_STATE_INVALID);
yelp_toc_pager_unpause (yelp_toc_pager_get ());
// FIXME: actually cancel
......@@ -396,7 +394,7 @@ db_pager_cancel (YelpPager *pager)
static void
db_pager_finish (YelpPager *pager)
{
d (printf ("db_pager_finish\n"));
d (g_print ("db_pager_finish\n"));
yelp_pager_set_state (pager, YELP_PAGER_STATE_FINISHED);
yelp_toc_pager_unpause (yelp_toc_pager_get ());
}
......
......@@ -28,6 +28,94 @@
#include <nsIInterfaceRequestorUtils.h>
#include <nsReadableUtils.h>
#include <nsString.h>
#include <nsIPrefService.h>
#include <nsIServiceManager.h>
#include <stdlib.h>
#include "yelp-gecko-utils.h"
static gboolean
yelp_util_split_font_string (const gchar *font_name, gchar **name, gint *size)
{
gchar *tmp_name, *ch;
tmp_name = g_strdup (font_name);
ch = g_utf8_strrchr (tmp_name, -1, ' ');
if (!ch || ch == tmp_name) {
return FALSE;
}
*ch = '\0';
*name = g_strdup (tmp_name);
*size = strtol (ch + 1, (char **) NULL, 10);
return TRUE;
}
static gboolean
gecko_prefs_set_string (const gchar *key, const gchar *value)
{
nsCOMPtr<nsIPrefService> prefService =
do_GetService (NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> pref;
prefService->GetBranch ("", getter_AddRefs (pref));
if (pref) {
nsresult rv = pref->SetCharPref (key, value);
return NS_SUCCEEDED (rv) ? TRUE : FALSE;
}
return FALSE;
}
static gboolean
gecko_prefs_set_int (const gchar *key, gint value)
{
nsCOMPtr<nsIPrefService> prefService =
do_GetService (NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> pref;
prefService->GetBranch ("", getter_AddRefs (pref));
if (pref) {
nsresult rv = pref->SetIntPref (key, value);
return NS_SUCCEEDED (rv) ? TRUE : FALSE;
}
return FALSE;
}
extern "C" void
yelp_gecko_set_font (YelpFontType font_type, const gchar *fontname)
{
gchar *name;
gint size;
name = NULL;
if (!yelp_util_split_font_string (fontname, &name, &size)) {
g_free (name);
return;
}
switch (font_type) {
case YELP_FONT_VARIABLE:
gecko_prefs_set_string ("font.name.variable.x-western",
name);
gecko_prefs_set_int ("font.size.variable.x-western",
size);
break;
case YELP_FONT_FIXED:
gecko_prefs_set_string ("font.name.fixed.x-western",
name);
gecko_prefs_set_int ("font.size.fixed.x-western",
size);
break;
}
g_free (name);
}
extern "C" gboolean
yelp_gecko_find (GtkMozEmbed *embed,
......
......@@ -23,15 +23,20 @@
#ifndef __YELP_GECKO_UTILS_H__
#define __YELP_GECKO_UTILS_H__
#include <gtkmozembed.h>
#include "yelp-settings.h"
G_BEGIN_DECLS
gboolean yelp_gecko_find (GtkMozEmbed *html,
const gchar *str,
gboolean match_case,
gboolean wrap,
gboolean forward);
void yelp_gecko_set_font (YelpFontType font_type,
const gchar *fontname);
gboolean yelp_gecko_find (GtkMozEmbed *html,
const gchar *str,
gboolean match_case,
gboolean wrap,
gboolean forward);
G_END_DECLS
#endif /* __YELP_HTML_H__ */
#endif /* __YELP_GECKO_UTILS_H__ */
......@@ -30,6 +30,7 @@
#include "yelp-html.h"
#include "yelp-marshal.h"
#include "yelp-gecko-utils.h"
#include "yelp-settings.h"
#ifdef YELP_DEBUG
#define d(x) x
......@@ -45,6 +46,7 @@ struct _YelpHtmlPriv {
static void html_init (YelpHtml *html);
static void html_class_init (YelpHtmlClass *klass);
static void html_set_fonts (void);
enum {
URI_SELECTED,
......@@ -100,8 +102,8 @@ embed_open_uri_cb (GtkMozEmbed *embed, const gchar *uri, YelpHtml *html)
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (YELP_IS_HTML (html), FALSE);
d (printf ("embed_open_uri_cb\n"));
d (printf (" uri = \"%s\"\n", uri));
d (g_print ("embed_open_uri_cb\n"));
d (g_print (" uri = \"%s\"\n", uri));