[gedit] view-holder: a few minor code improvements
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] view-holder: a few minor code improvements
- Date: Fri, 26 Jun 2015 08:59:32 +0000 (UTC)
commit 80e6e43771597abd87ce22aa66ff607ab6adceed
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 26 10:34:35 2015 +0200
view-holder: a few minor code improvements
- use bit fields for booleans in a struct
- sanitize the gboolean to take only one bit (!= FALSE)
- put the new() function at the top (since it's generally the first
function called)
gedit/gedit-view-holder.c | 4 ++--
gedit/gedit-view-holder.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-view-holder.c b/gedit/gedit-view-holder.c
index b21391f..86ddab9 100644
--- a/gedit/gedit-view-holder.c
+++ b/gedit/gedit-view-holder.c
@@ -40,8 +40,8 @@ struct _GeditViewHolderPrivate
GdkRGBA view_line_margin_fg;
GdkRGBA view_margin_background;
guint view_text_width;
- gboolean centering;
+ guint centering : 1;
guint view_background_set : 1;
guint view_line_margin_fg_set : 1;
guint view_margin_background_set : 1;
@@ -459,7 +459,7 @@ gedit_view_holder_set_centering (GeditViewHolder *container,
{
g_return_if_fail (GEDIT_IS_VIEW_HOLDER (container));
- container->priv->centering = centering;
+ container->priv->centering = centering != FALSE;
on_view_right_margin_visibility_changed (GEDIT_VIEW (container->priv->sourceview), NULL, container);
}
diff --git a/gedit/gedit-view-holder.h b/gedit/gedit-view-holder.h
index 0a256b4..2746087 100644
--- a/gedit/gedit-view-holder.h
+++ b/gedit/gedit-view-holder.h
@@ -52,13 +52,13 @@ struct _GeditViewHolderClass
GType gedit_view_holder_get_type (void) G_GNUC_CONST;
+GeditViewHolder *gedit_view_holder_new (void);
+
void gedit_view_holder_set_centering (GeditViewHolder *container,
gboolean centering);
gboolean gedit_view_holder_get_centering (GeditViewHolder *container);
-GeditViewHolder *gedit_view_holder_new (void);
-
G_END_DECLS
#endif /* __GEDIT_VIEW_HOLDER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]