[evince/wip/app] libdocument: Use G_PARAM_STATIC_STRINGS



commit d3917306abfd1f91950f98085b64aa630fc463a6
Author: Christian Persch <chpe gnome org>
Date:   Wed Jun 13 21:07:22 2012 +0200

    libdocument: Use G_PARAM_STATIC_STRINGS
    
    This saves some string copies.

 libdocument/ev-annotation.c        |   39 ++++++++++++++++++++++++------------
 libdocument/ev-attachment.c        |   18 +++++++++++-----
 libdocument/ev-link-action.c       |   27 ++++++++++++++++--------
 libdocument/ev-link-dest.c         |   30 ++++++++++++++++++---------
 libdocument/ev-link.c              |    6 +++-
 libdocument/ev-transition-effect.c |   21 ++++++++++++------
 6 files changed, 94 insertions(+), 47 deletions(-)
---
diff --git a/libdocument/ev-annotation.c b/libdocument/ev-annotation.c
index 304ccc6..7471d9a 100644
--- a/libdocument/ev-annotation.c
+++ b/libdocument/ev-annotation.c
@@ -229,28 +229,32 @@ ev_annotation_class_init (EvAnnotationClass *klass)
 							      "Page",
 							      "The page wehere the annotation is",
 							      EV_TYPE_PAGE,
-							      G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_ANNOT_CONTENTS,
 					 g_param_spec_string ("contents",
 							      "Contents",
 							      "The annotation contents",
 							      NULL,
-							      G_PARAM_READWRITE));
+							      G_PARAM_READWRITE |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_ANNOT_NAME,
 					 g_param_spec_string ("name",
 							      "Name",
 							      "The annotation unique name",
 							      NULL,
-							      G_PARAM_READWRITE));
+							      G_PARAM_READWRITE |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_ANNOT_MODIFIED,
 					 g_param_spec_string ("modified",
 							      "Modified",
 							      "Last modified date as string",
 							      NULL,
-							      G_PARAM_READWRITE));
+							      G_PARAM_READWRITE |
+                                                              G_PARAM_STATIC_STRINGS));
         /**
          * EvAnnotation:rgba:
          *
@@ -263,7 +267,8 @@ ev_annotation_class_init (EvAnnotationClass *klass)
 					 g_param_spec_pointer ("color",
 							       "Color",
 							       "The annotation color",
-							       G_PARAM_READWRITE));
+							       G_PARAM_READWRITE |
+                                                               G_PARAM_STATIC_STRINGS));
 
         /**
          * EvAnnotation:rgba:
@@ -644,7 +649,8 @@ ev_annotation_markup_default_init (EvAnnotationMarkupInterface *iface)
 									  "Label",
 									  "Label of the markup annotation",
 									  NULL,
-									  G_PARAM_READWRITE));
+									  G_PARAM_READWRITE |
+                                                                          G_PARAM_STATIC_STRINGS));
 		g_object_interface_install_property (iface,
 						     g_param_spec_double ("opacity",
 									  "Opacity",
@@ -652,28 +658,32 @@ ev_annotation_markup_default_init (EvAnnotationMarkupInterface *iface)
 									  0,
 									  G_MAXDOUBLE,
 									  1.,
-									  G_PARAM_READWRITE));
+									  G_PARAM_READWRITE |
+                                                                          G_PARAM_STATIC_STRINGS));
 		g_object_interface_install_property (iface,
 						     g_param_spec_boolean ("has_popup",
 									   "Has popup",
 									   "Whether the markup annotation has "
 									   "a popup window associated",
 									   TRUE,
-									   G_PARAM_READWRITE));
+									   G_PARAM_READWRITE |
+                                                                           G_PARAM_STATIC_STRINGS));
 		g_object_interface_install_property (iface,
 						     g_param_spec_boxed ("rectangle",
 									 "Rectangle",
 									 "The Rectangle of the popup associated "
 									 "to the markup annotation",
 									 EV_TYPE_RECTANGLE,
-									 G_PARAM_READWRITE));
+									 G_PARAM_READWRITE |
+                                                                         G_PARAM_STATIC_STRINGS));
 		g_object_interface_install_property (iface,
 						     g_param_spec_boolean ("popup_is_open",
 									   "PopupIsOpen",
 									   "Whether the popup associated to "
 									   "the markup annotation is open",
 									   FALSE,
-									   G_PARAM_READWRITE));
+									   G_PARAM_READWRITE |
+                                                                           G_PARAM_STATIC_STRINGS));
 		initialized = TRUE;
 	}
 }
@@ -1011,14 +1021,16 @@ ev_annotation_text_class_init (EvAnnotationTextClass *klass)
 							    "The icon fo the text annotation",
 							    EV_TYPE_ANNOTATION_TEXT_ICON,
 							    EV_ANNOTATION_TEXT_ICON_NOTE,
-							    G_PARAM_READWRITE));
+							    G_PARAM_READWRITE |
+                                                            G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_TEXT_IS_OPEN,
 					 g_param_spec_boolean ("is_open",
 							       "IsOpen",
 							       "Whether text annot is initially open",
 							       FALSE,
-							       G_PARAM_READWRITE));
+							       G_PARAM_READWRITE |
+                                                               G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -1164,7 +1176,8 @@ ev_annotation_attachment_class_init (EvAnnotationAttachmentClass *klass)
 							      "The attachment of the annotation",
 							      EV_TYPE_ATTACHMENT,
 							      G_PARAM_CONSTRUCT |
-							      G_PARAM_READWRITE));
+							      G_PARAM_READWRITE |
+                                                              G_PARAM_STATIC_STRINGS));
 }
 
 static void
diff --git a/libdocument/ev-attachment.c b/libdocument/ev-attachment.c
index 912a50e..d8b4ba9 100644
--- a/libdocument/ev-attachment.c
+++ b/libdocument/ev-attachment.c
@@ -162,7 +162,8 @@ ev_attachment_class_init (EvAttachmentClass *klass)
 							      "The attachment name",
 							      NULL,
 							      G_PARAM_WRITABLE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_DESCRIPTION,
 					 g_param_spec_string ("description",
@@ -170,7 +171,8 @@ ev_attachment_class_init (EvAttachmentClass *klass)
 							      "The attachment description",
 							      NULL,
 							      G_PARAM_WRITABLE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_MTIME,
 					 g_param_spec_ulong ("mtime",
@@ -178,7 +180,8 @@ ev_attachment_class_init (EvAttachmentClass *klass)
 							     "The attachment modification date",
 							     0, G_MAXULONG, 0,
 							     G_PARAM_WRITABLE |
-							     G_PARAM_CONSTRUCT_ONLY));
+							     G_PARAM_CONSTRUCT_ONLY |
+                                                             G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_CTIME,
 					 g_param_spec_ulong ("ctime",
@@ -186,7 +189,8 @@ ev_attachment_class_init (EvAttachmentClass *klass)
 							     "The attachment creation date",
 							     0, G_MAXULONG, 0,
 							     G_PARAM_WRITABLE |
-							     G_PARAM_CONSTRUCT_ONLY));
+							     G_PARAM_CONSTRUCT_ONLY |
+                                                             G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_SIZE,
 					 g_param_spec_uint ("size",
@@ -194,14 +198,16 @@ ev_attachment_class_init (EvAttachmentClass *klass)
 							    "The attachment size",
 							    0, G_MAXUINT, 0,
 							    G_PARAM_WRITABLE |
-							    G_PARAM_CONSTRUCT_ONLY));
+							    G_PARAM_CONSTRUCT_ONLY |
+                                                            G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_DATA,
 					 g_param_spec_pointer ("data",
 							       "Data",
 							       "The attachment data",
 							       G_PARAM_WRITABLE |
-							       G_PARAM_CONSTRUCT_ONLY));
+							       G_PARAM_CONSTRUCT_ONLY |
+                                                               G_PARAM_STATIC_STRINGS));
 	
 	g_object_class->finalize = ev_attachment_finalize;
 }
diff --git a/libdocument/ev-link-action.c b/libdocument/ev-link-action.c
index f7fcb2b..ccbebfb 100644
--- a/libdocument/ev-link-action.c
+++ b/libdocument/ev-link-action.c
@@ -315,14 +315,16 @@ ev_link_action_class_init (EvLinkActionClass *ev_link_action_class)
 							     EV_TYPE_LINK_ACTION_TYPE,
 							     EV_LINK_ACTION_TYPE_GOTO_DEST,
 							     G_PARAM_READWRITE |
-							     G_PARAM_CONSTRUCT_ONLY));
+							     G_PARAM_CONSTRUCT_ONLY |
+                                                             G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_DEST,
 					 g_param_spec_pointer ("dest",
 							       "Action destination",
 							       "The link action destination",
 							       G_PARAM_READWRITE |
-							       G_PARAM_CONSTRUCT_ONLY));
+							       G_PARAM_CONSTRUCT_ONLY |
+                                                               G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_URI,
 					 g_param_spec_string ("uri",
@@ -330,7 +332,8 @@ ev_link_action_class_init (EvLinkActionClass *ev_link_action_class)
 							      "The link action URI",
 							      NULL,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_FILENAME,
 					 g_param_spec_string ("filename",
@@ -338,7 +341,8 @@ ev_link_action_class_init (EvLinkActionClass *ev_link_action_class)
 							      "The link action filename",
 							      NULL,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_PARAMS,
 					 g_param_spec_string ("params",
@@ -346,7 +350,8 @@ ev_link_action_class_init (EvLinkActionClass *ev_link_action_class)
 							      "The link action params",
 							      NULL,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_NAME,
 					 g_param_spec_string ("name",
@@ -354,28 +359,32 @@ ev_link_action_class_init (EvLinkActionClass *ev_link_action_class)
 							      "The link action name",
 							      NULL,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_SHOW_LIST,
 					 g_param_spec_pointer ("show-list",
 							       "ShowList",
 							       "The list of layers that should be shown",
 							       G_PARAM_READWRITE |
-							       G_PARAM_CONSTRUCT_ONLY));
+							       G_PARAM_CONSTRUCT_ONLY |
+                                                               G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_HIDE_LIST,
 					 g_param_spec_pointer ("hide-list",
 							       "HideList",
 							       "The list of layers that should be hidden",
 							       G_PARAM_READWRITE |
-							       G_PARAM_CONSTRUCT_ONLY));
+							       G_PARAM_CONSTRUCT_ONLY |
+                                                               G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_TOGGLE_LIST,
 					 g_param_spec_pointer ("toggle-list",
 							       "ToggleList",
 							       "The list of layers that should be toggled",
 							       G_PARAM_READWRITE |
-							       G_PARAM_CONSTRUCT_ONLY));
+							       G_PARAM_CONSTRUCT_ONLY |
+                                                               G_PARAM_STATIC_STRINGS));
 }
 
 EvLinkAction *
diff --git a/libdocument/ev-link-dest.c b/libdocument/ev-link-dest.c
index 9d5d860..3e45d2f 100644
--- a/libdocument/ev-link-dest.c
+++ b/libdocument/ev-link-dest.c
@@ -300,7 +300,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							     EV_TYPE_LINK_DEST_TYPE,
 							     EV_LINK_DEST_TYPE_UNKNOWN,
 							     G_PARAM_READWRITE |
-							     G_PARAM_CONSTRUCT_ONLY));
+							     G_PARAM_CONSTRUCT_ONLY |
+                                                             G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_PAGE,
 					 g_param_spec_int ("page",
@@ -310,7 +311,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							   G_MAXINT,
 							   0,
 							   G_PARAM_READWRITE |
-							   G_PARAM_CONSTRUCT_ONLY));
+							   G_PARAM_CONSTRUCT_ONLY |
+                                                           G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_LEFT,
 					 g_param_spec_double ("left",
@@ -320,7 +322,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							      G_MAXDOUBLE,
 							      0,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_TOP,
 					 g_param_spec_double ("top",
@@ -330,7 +333,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							      G_MAXDOUBLE,
 							      0,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_BOTTOM,
 					 g_param_spec_double ("bottom",
@@ -340,7 +344,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							      G_MAXDOUBLE,
 							      0,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_RIGHT,
 					 g_param_spec_double ("right",
@@ -350,7 +355,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							      G_MAXDOUBLE,
 							      0,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 
 	g_object_class_install_property (g_object_class,
 					 PROP_ZOOM,
@@ -361,7 +367,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							      G_MAXDOUBLE,
 							      0,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_CHANGE,
 					 g_param_spec_uint ("change",
@@ -371,7 +378,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							    G_MAXUINT,
 							    0,
 							    G_PARAM_READWRITE |
-							    G_PARAM_CONSTRUCT_ONLY));
+							    G_PARAM_CONSTRUCT_ONLY |
+                                                            G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_NAMED,
 					 g_param_spec_string ("named",
@@ -379,7 +387,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							      "The named destination",
 							      NULL,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_PAGE_LABEL,
 					 g_param_spec_string ("page_label",
@@ -387,7 +396,8 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
 							      "The label of the destination page",
 							      NULL,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 }
 
 EvLinkDest *
diff --git a/libdocument/ev-link.c b/libdocument/ev-link.c
index a9ad41e..0a51f23 100644
--- a/libdocument/ev-link.c
+++ b/libdocument/ev-link.c
@@ -160,14 +160,16 @@ ev_link_class_init (EvLinkClass *ev_window_class)
 				     			      "The link title",
 							      NULL,
 							      G_PARAM_READWRITE |
-				     			      G_PARAM_CONSTRUCT_ONLY));
+				     			      G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (g_object_class,
 					 PROP_ACTION,
 					 g_param_spec_pointer ("action",
 							       "Link Action",
 							       "The link action",
 							       G_PARAM_READWRITE |
-							       G_PARAM_CONSTRUCT_ONLY));
+							       G_PARAM_CONSTRUCT_ONLY |
+                                                               G_PARAM_STATIC_STRINGS));
 }
 
 EvLink *
diff --git a/libdocument/ev-transition-effect.c b/libdocument/ev-transition-effect.c
index 96b6c1c..9250abc 100644
--- a/libdocument/ev-transition-effect.c
+++ b/libdocument/ev-transition-effect.c
@@ -154,7 +154,8 @@ ev_transition_effect_class_init (EvTransitionEffectClass *klass)
 							    "Page transition effect type",
 							    EV_TYPE_TRANSITION_EFFECT_TYPE,
 							    EV_TRANSITION_EFFECT_REPLACE,
-							    G_PARAM_READWRITE));
+							    G_PARAM_READWRITE |
+                                                            G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (object_class,
 					 PROP_ALIGNMENT,
 					 g_param_spec_enum ("alignment",
@@ -162,7 +163,8 @@ ev_transition_effect_class_init (EvTransitionEffectClass *klass)
 							    "Alignment for the effect",
 							    EV_TYPE_TRANSITION_EFFECT_ALIGNMENT,
 							    EV_TRANSITION_ALIGNMENT_HORIZONTAL,
-							    G_PARAM_READWRITE));
+							    G_PARAM_READWRITE |
+                                                            G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (object_class,
 					 PROP_DIRECTION,
 					 g_param_spec_enum ("direction",
@@ -170,14 +172,16 @@ ev_transition_effect_class_init (EvTransitionEffectClass *klass)
 							    "Direction for the effect",
 							    EV_TYPE_TRANSITION_EFFECT_DIRECTION,
 							    EV_TRANSITION_DIRECTION_INWARD,
-							    G_PARAM_READWRITE));
+							    G_PARAM_READWRITE |
+                                                            G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (object_class,
 					 PROP_DURATION,
 					 g_param_spec_int ("duration",
 							   "Effect duration",
 							   "Effect duration in seconds",
 							   0, G_MAXINT, 0,
-							   G_PARAM_READWRITE));
+							   G_PARAM_READWRITE |
+                                                           G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (object_class,
 					 PROP_ANGLE,
 					 g_param_spec_int ("angle",
@@ -185,21 +189,24 @@ ev_transition_effect_class_init (EvTransitionEffectClass *klass)
 							   "Effect angle in degrees, counted "
 							   "counterclockwise from left to right",
 							   0, 360, 0,
-							   G_PARAM_READWRITE));
+							   G_PARAM_READWRITE |
+                                                           G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (object_class,
 					 PROP_SCALE,
 					 g_param_spec_double ("scale",
 							      "Effect scale",
 							      "Scale at which the effect is applied",
 							      0., 1., 1.,
-							      G_PARAM_READWRITE));
+							      G_PARAM_READWRITE |
+                                                              G_PARAM_STATIC_STRINGS));
 	g_object_class_install_property (object_class,
 					 PROP_RECTANGULAR,
 					 g_param_spec_boolean ("rectangular",
 							       "Rectangular area",
 							       "Whether the covered area is rectangular",
 							       FALSE,
-							       G_PARAM_READWRITE));
+							       G_PARAM_READWRITE |
+                                                               G_PARAM_STATIC_STRINGS));
 
 	g_type_class_add_private (klass, sizeof (EvTransitionEffectPrivate));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]