Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-module.c File Reference
#include "config.h"
#include "ev-module.h"
#include <gmodule.h>
+ Include dependency graph for ev-module.c:

Go to the source code of this file.

Data Structures

struct  _EvModuleClass
 
struct  _EvModule
 

Macros

#define ev_module_get_type   _ev_module_get_type
 

Typedefs

typedef struct _EvModuleClass EvModuleClass
 
typedef GType(* EvModuleRegisterFunc )(GTypeModule *)
 

Functions

static void ev_module_init (EvModule *action)
 
static void ev_module_class_init (EvModuleClass *class)
 
static gboolean ev_module_load (GTypeModule *gmodule)
 
static void ev_module_unload (GTypeModule *gmodule)
 
const gchar * _ev_module_get_path (EvModule *module)
 
GObject * _ev_module_new_object (EvModule *module)
 
GType _ev_module_get_object_type (EvModule *module)
 
static void ev_module_finalize (GObject *object)
 
EvModule_ev_module_new (const gchar *path, gboolean resident)
 

Macro Definition Documentation

#define ev_module_get_type   _ev_module_get_type

Definition at line 68 of file ev-module.c.

Typedef Documentation

typedef struct _EvModuleClass EvModuleClass

Definition at line 47 of file ev-module.c.

typedef GType(* EvModuleRegisterFunc)(GTypeModule *)

Definition at line 63 of file ev-module.c.

Function Documentation

GType _ev_module_get_object_type ( EvModule module)

Definition at line 146 of file ev-module.c.

147 {
148  g_return_val_if_fail (EV_IS_MODULE (module), 0);
149 
150  return module->type;
151 }
const gchar* _ev_module_get_path ( EvModule module)

Definition at line 127 of file ev-module.c.

128 {
129  g_return_val_if_fail (EV_IS_MODULE (module), NULL);
130 
131  return module->path;
132 }
EvModule* _ev_module_new ( const gchar *  path,
gboolean  resident 
)

Definition at line 181 of file ev-module.c.

183 {
184  EvModule *result;
185 
186  g_return_val_if_fail (path != NULL && path[0] != '\0', NULL);
187 
188  result = g_object_new (EV_TYPE_MODULE, NULL);
189 
190  g_type_module_set_name (G_TYPE_MODULE (result), path);
191  result->path = g_strdup (path);
192  result->resident = resident;
193 
194  return result;
195 }

+ Here is the caller graph for this function:

GObject* _ev_module_new_object ( EvModule module)

Definition at line 135 of file ev-module.c.

136 {
137  g_return_val_if_fail (EV_IS_MODULE (module), NULL);
138 
139  if (module->type == 0)
140  return NULL;
141 
142  return g_object_new (module->type, NULL);
143 }

+ Here is the caller graph for this function:

static void ev_module_class_init ( EvModuleClass class)
static

Definition at line 169 of file ev-module.c.

170 {
171  GObjectClass *object_class = G_OBJECT_CLASS (class);
172  GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
173 
174  object_class->finalize = ev_module_finalize;
175 
176  module_class->load = ev_module_load;
177  module_class->unload = ev_module_unload;
178 }
static void ev_module_finalize ( GObject *  object)
static

Definition at line 159 of file ev-module.c.

160 {
161  EvModule *module = EV_MODULE (object);
162 
163  g_free (module->path);
164 
165  G_OBJECT_CLASS (ev_module_parent_class)->finalize (object);
166 }

+ Here is the caller graph for this function:

static void ev_module_init ( EvModule action)
static

Definition at line 154 of file ev-module.c.

155 {
156 }
static gboolean ev_module_load ( GTypeModule *  gmodule)
static

Definition at line 72 of file ev-module.c.

73 {
74  EvModule *module = EV_MODULE (gmodule);
75  EvModuleRegisterFunc register_func;
76 
77  module->library = g_module_open (module->path, 0);
78 
79  if (!module->library) {
80  g_warning ("%s", g_module_error ());
81 
82  return FALSE;
83  }
84 
85  /* extract symbols from the lib */
86  if (!g_module_symbol (module->library, "register_evince_backend",
87  (void *) &register_func)) {
88  g_warning ("%s", g_module_error ());
89  g_module_close (module->library);
90 
91  return FALSE;
92  }
93 
94  /* symbol can still be NULL even though g_module_symbol
95  * returned TRUE */
96  if (!register_func) {
97  g_warning ("Symbol 'register_evince_backend' should not be NULL");
98  g_module_close (module->library);
99 
100  return FALSE;
101  }
102 
103  module->type = register_func (gmodule);
104 
105  if (module->type == 0) {
106  g_warning ("Invalid evince backend contained by module %s", module->path);
107 
108  return FALSE;
109  }
110 
111  if (module->resident)
112  g_module_make_resident (module->library);
113 
114  return TRUE;
115 }

+ Here is the caller graph for this function:

static void ev_module_unload ( GTypeModule *  gmodule)
static

Definition at line 118 of file ev-module.c.

119 {
120  EvModule *module = EV_MODULE (gmodule);
121 
122  g_module_close (module->library);
123  module->library = NULL;
124 }

+ Here is the caller graph for this function: