Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GNOME
yelp
Commits
0d8bb512
Commit
0d8bb512
authored
Apr 21, 2010
by
Shaun McCance
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use GSettings for show-cursor and font-adjustment preferences
parent
29e4dcbe
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
51 deletions
+43
-51
configure.in
configure.in
+3
-1
data/Makefile.am
data/Makefile.am
+7
-0
data/org.gnome.yelp.gschema.xml
data/org.gnome.yelp.gschema.xml
+14
-0
src/yelp-application.c
src/yelp-application.c
+19
-34
src/yelp-application.h
src/yelp-application.h
+0
-2
src/yelp-window.c
src/yelp-window.c
+0
-14
No files found.
configure.in
View file @
0d8bb512
...
...
@@ -50,7 +50,7 @@ AM_GLIB_DEFINE_LOCALEDIR([GNOMELOCALEDIR])
PKG_CHECK_MODULES(YELP,
[
gio-2.0
gio-2.0
>= 2.25.2
gio-unix-2.0
gtk+-unix-print-2.0
gtk+-2.0 >= 2.16.0
...
...
@@ -79,6 +79,8 @@ AC_SUBST([YELP_LIBS])
AC_PATH_PROGS(SED, gsed sed)
AM_GSETTINGS
XSL_PATH="`$PKG_CONFIG --variable=xsltdir yelp-xsl`"
XSL_DB_TITLE="$XSLT_PATH""/docbook/common/db-title.xsl"
AC_SUBST(XSL_DB_TITLE)
...
...
data/Makefile.am
View file @
0d8bb512
...
...
@@ -3,6 +3,13 @@ SUBDIRS = icons ui
@INTLTOOL_XML_RULE@
@INTLTOOL_SCHEMAS_RULE@
gsettingsschema_DATA
=
org.gnome.yelp.gschema.xml
@GSETTINGS_CHECK_RULE@
if
GSETTINGS_SCHEMAS_INSTALL
install-data-hook
:
$(gschema_compile)
$(DESTDIR)$(gsettingsschemadir)
endif
tocdir
=
$(datadir)
/yelp
toc_DATA
=
man.xml toc.xml scrollkeeper.xml info.xml
...
...
data/org.gnome.yelp.gschema.xml
0 → 100644
View file @
0d8bb512
<schemalist>
<schema
id=
"org.gnome.yelp"
path=
"/org/gnome/yelp"
>
<key
name=
"show-cursor"
type=
"b"
>
<default>
false
</default>
</key>
<key
name=
"font-adjustment"
type=
"i"
>
<default>
0
</default>
<range>
<min>
-3
</min>
<max>
10
</max>
</range>
</key>
</schema>
</schemalist>
src/yelp-application.c
View file @
0d8bb512
...
...
@@ -75,19 +75,26 @@ struct _YelpApplicationPrivate {
GHashTable
*
windows_by_document
;
gboolean
show_text_cursor
;
gboolean
map_show_text_cursor
;
GSettings
*
gsettings
;
};
static
void
yelp_application_init
(
YelpApplication
*
app
)
{
YelpSettings
*
settings
=
yelp_settings_get_default
();
YelpApplicationPrivate
*
priv
=
GET_PRIV
(
app
);
priv
->
windows_by_document
=
g_hash_table_new_full
(
g_str_hash
,
g_str_equal
,
g_free
,
NULL
);
priv
->
gsettings
=
g_settings_new
(
"org.gnome.yelp"
);
g_settings_bind
(
priv
->
gsettings
,
"show-cursor"
,
settings
,
"show-text-cursor"
,
G_SETTINGS_BIND_DEFAULT
);
g_settings_bind
(
priv
->
gsettings
,
"font-adjustment"
,
settings
,
"font-adjustment"
,
G_SETTINGS_BIND_DEFAULT
);
}
static
void
...
...
@@ -114,6 +121,11 @@ yelp_application_dispose (GObject *object)
priv
->
connection
=
NULL
;
}
if
(
priv
->
gsettings
)
{
g_object_unref
(
priv
->
gsettings
);
priv
->
gsettings
=
NULL
;
}
G_OBJECT_CLASS
(
yelp_application_parent_class
)
->
dispose
(
object
);
}
...
...
@@ -138,8 +150,8 @@ yelp_application_adjust_font (YelpApplication *app,
YelpSettings
*
settings
=
yelp_settings_get_default
();
GParamSpec
*
spec
=
g_object_class_find_property
((
GObjectClass
*
)
YELP_SETTINGS_GET_CLASS
(
settings
),
"font-adjustment"
);
gint
adjustment
=
yelp_settings_get_font_adjustment
(
settings
);
YelpApplicationPrivate
*
priv
=
GET_PRIV
(
app
);
gint
adjustment
=
g_settings_get_int
(
priv
->
gsettings
,
"font-adjustment"
);
if
(
!
G_PARAM_SPEC_INT
(
spec
))
{
g_warning
(
"Expcected integer param spec for font-adjustment"
);
...
...
@@ -147,7 +159,7 @@ yelp_application_adjust_font (YelpApplication *app,
}
adjustment
+=
adjust
;
yelp
_settings_set_font
_
adjustment
(
settings
,
adjustment
);
g
_settings_set_
int
(
priv
->
gsettings
,
"
font
-
adjustment
"
,
adjustment
);
for
(
cur
=
priv
->
windows
;
cur
!=
NULL
;
cur
=
cur
->
next
)
{
YelpWindow
*
win
=
(
YelpWindow
*
)
cur
->
data
;
...
...
@@ -162,32 +174,6 @@ yelp_application_adjust_font (YelpApplication *app,
}
}
void
yelp_application_set_show_text_cursor
(
YelpApplication
*
app
,
gboolean
show
)
{
GSList
*
cur
;
YelpSettings
*
settings
=
yelp_settings_get_default
();
YelpApplicationPrivate
*
priv
=
GET_PRIV
(
app
);
/* We get callbacks in the loop. Ignore them. */
if
(
priv
->
map_show_text_cursor
)
return
;
priv
->
show_text_cursor
=
show
;
yelp_settings_set_show_text_cursor
(
settings
,
show
);
priv
->
map_show_text_cursor
=
TRUE
;
for
(
cur
=
priv
->
windows
;
cur
!=
NULL
;
cur
=
cur
->
next
)
{
YelpWindow
*
win
=
(
YelpWindow
*
)
cur
->
data
;
GtkActionGroup
*
group
=
yelp_window_get_action_group
(
win
);
GtkAction
*
action
;
action
=
gtk_action_group_get_action
(
group
,
"ShowTextCursor"
);
gtk_toggle_action_set_active
(
GTK_TOGGLE_ACTION
(
action
),
show
);
}
priv
->
map_show_text_cursor
=
FALSE
;
}
/******************************************************************************/
YelpApplication
*
...
...
@@ -362,10 +348,9 @@ application_uri_resolved (YelpUri *uri,
group
=
yelp_window_get_action_group
(
window
);
action
=
gtk_action_group_get_action
(
group
,
"ShowTextCursor"
);
priv
->
map_show_text_cursor
=
TRUE
;
gtk_toggle_action_set_active
(
GTK_TOGGLE_ACTION
(
action
),
priv
->
show_text_cursor
);
priv
->
map_show_text_cursor
=
FALSE
;
g_settings_bind
(
priv
->
gsettings
,
"show-cursor"
,
action
,
"active"
,
G_SETTINGS_BIND_DEFAULT
);
if
(
!
data
->
new
)
{
g_hash_table_insert
(
priv
->
windows_by_document
,
doc_uri
,
window
);
...
...
src/yelp-application.h
View file @
0d8bb512
...
...
@@ -59,8 +59,6 @@ void yelp_application_new_window (YelpApplication *app,
void
yelp_application_adjust_font
(
YelpApplication
*
app
,
gint
adjust
);
void
yelp_application_set_show_text_cursor
(
YelpApplication
*
app
,
gboolean
show
);
void
yelp_application_install_package
(
YelpApplication
*
app
,
const
gchar
*
pkg
,
const
gchar
*
alt
);
...
...
src/yelp-window.c
View file @
0d8bb512
...
...
@@ -57,8 +57,6 @@ static void window_open_location (GtkAction *action,
YelpWindow
*
window
);
static
void
window_font_adjustment
(
GtkAction
*
action
,
YelpWindow
*
window
);
static
void
window_show_text_cursor
(
GtkToggleAction
*
action
,
YelpWindow
*
window
);
static
void
window_go_back
(
GtkAction
*
action
,
YelpWindow
*
window
);
static
void
window_go_forward
(
GtkAction
*
action
,
...
...
@@ -228,8 +226,6 @@ yelp_window_init (YelpWindow *window)
action
=
(
GtkAction
*
)
gtk_toggle_action_new
(
"ShowTextCursor"
,
_
(
"Show Text _Cursor"
),
NULL
,
NULL
);
g_signal_connect
(
action
,
"activate"
,
G_CALLBACK
(
window_show_text_cursor
),
window
);
gtk_action_group_add_action_with_accel
(
priv
->
action_group
,
action
,
"F7"
);
...
...
@@ -547,16 +543,6 @@ window_font_adjustment (GtkAction *action,
g_str_equal
(
gtk_action_get_name
(
action
),
"LargerText"
)
?
1
:
-
1
);
}
static
void
window_show_text_cursor
(
GtkToggleAction
*
action
,
YelpWindow
*
window
)
{
YelpWindowPrivate
*
priv
=
GET_PRIV
(
window
);
yelp_application_set_show_text_cursor
(
priv
->
application
,
gtk_toggle_action_get_active
(
action
));
}
static
void
window_go_back
(
GtkAction
*
action
,
YelpWindow
*
window
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment