#include <libermetadb/ermetadb.h>
Go to the source code of this file.
Functions | |
G_BEGIN_DECLS void | meta_initialize (void) |
void | meta_finalize (void) |
void | meta_file_open (const gchar *filepath) |
gdouble | meta_get_h_position (void) |
gdouble | meta_get_v_position (void) |
gfloat | meta_get_zoom_level (void) |
gboolean | meta_get_full_screen (void) |
void | meta_set_h_position (gdouble position) |
void | meta_set_v_position (gdouble position) |
void | meta_set_zoom_level (gfloat factor) |
void | meta_set_full_screen (gboolean is_full_screen) |
void meta_file_open | ( | const gchar * | filepath | ) |
Definition at line 196 of file metadata.c.
References DEFAULT_FULL_SCREEN, DEFAULT_H_POSITION, DEFAULT_V_POSITION, DEFAULT_ZOOM_LEVEL, ER_OK, ermetadb_close(), ermetadb_local_get_application_data(), ermetadb_local_open(), g_filename, g_full_screen, g_h_position, g_path, g_should_save, g_v_position, g_zoom_level, get_boolean(), get_double(), LOGPRINTF, meta_file_close(), META_FULL_SCREEN, META_H_POSITION, META_V_POSITION, META_ZOOM_LEVEL, metadata_table_add_column(), metadata_table_free, and metadata_table_new().
Referenced by view_open_uri().
00197 { 00198 LOGPRINTF("entry file='%s'", filepath); 00199 00200 // close if already open 00201 if (g_path || g_filename) 00202 { 00203 meta_file_close(); 00204 } 00205 00206 g_path = g_path_get_dirname(filepath); 00207 g_filename = g_path_get_basename(filepath); 00208 00209 // initialize to default values 00210 g_should_save = FALSE; 00211 g_h_position = DEFAULT_H_POSITION; 00212 g_v_position = DEFAULT_V_POSITION; 00213 g_zoom_level = DEFAULT_ZOOM_LEVEL; 00214 g_full_screen = DEFAULT_FULL_SCREEN; 00215 00216 // try to open database 00217 erMetadb db = ermetadb_local_open(g_path, FALSE); 00218 if (db == NULL) { // db doesn't exist, ok 00219 LOGPRINTF("No (valid) metadata found for %s", filepath); 00220 return; 00221 } 00222 00223 // read values from db 00224 metadata_table *names_table = metadata_table_new(); 00225 metadata_table_add_column(names_table, META_H_POSITION); 00226 metadata_table_add_column(names_table, META_V_POSITION); 00227 metadata_table_add_column(names_table, META_ZOOM_LEVEL); 00228 metadata_table_add_column(names_table, META_FULL_SCREEN); 00229 00230 metadata_table *results_table = NULL; 00231 int ret = ermetadb_local_get_application_data(db, 00232 g_filename, 00233 names_table, 00234 &results_table); 00235 if (ret == ER_OK && results_table) { 00236 // assign to static variables 00237 get_double (results_table, META_H_POSITION, &g_h_position); 00238 get_double (results_table, META_V_POSITION, &g_v_position); 00239 get_double (results_table, META_ZOOM_LEVEL, &g_zoom_level); 00240 get_boolean(results_table, META_FULL_SCREEN, &g_full_screen); 00241 } else { 00242 LOGPRINTF("No (valid) application data found for %s, error %d", filepath, ret); 00243 } 00244 00245 metadata_table_free(names_table); 00246 metadata_table_free(results_table); 00247 ermetadb_close(db); 00248 }
void meta_finalize | ( | void | ) |
Definition at line 185 of file metadata.c.
References g_filename, g_path, LOGPRINTF, and meta_file_close().
Referenced by destroy_cb().
00186 { 00187 LOGPRINTF("entry"); 00188 00189 if (g_path || g_filename) 00190 { 00191 meta_file_close(); 00192 } 00193 }
gboolean meta_get_full_screen | ( | void | ) |
Definition at line 269 of file metadata.c.
References g_full_screen.
Referenced by view_open_uri().
00270 { 00271 return g_full_screen; 00272 }
gdouble meta_get_h_position | ( | void | ) |
Definition at line 251 of file metadata.c.
References g_h_position.
00252 { 00253 return g_h_position; 00254 }
gdouble meta_get_v_position | ( | void | ) |
Definition at line 257 of file metadata.c.
References g_v_position.
00258 { 00259 return g_v_position; 00260 }
gfloat meta_get_zoom_level | ( | void | ) |
Definition at line 263 of file metadata.c.
References g_zoom_level.
Referenced by view_open_uri().
00264 { 00265 return (gfloat) g_zoom_level; 00266 }
G_BEGIN_DECLS void meta_initialize | ( | void | ) |
File Name : metadata.h
Description: File metadata functions Copyright (C) 2009 iRex Technologies B.V. All rights reserved.
Definition at line 179 of file metadata.c.
References LOGPRINTF.
Referenced by view_create().
00180 { 00181 LOGPRINTF("entry"); 00182 }
void meta_set_full_screen | ( | gboolean | is_full_screen | ) |
Definition at line 314 of file metadata.c.
References g_full_screen, g_should_save, and LOGPRINTF.
Referenced by view_full_screen().
00315 { 00316 LOGPRINTF("entry"); 00317 00318 if (is_full_screen != g_full_screen) 00319 { 00320 LOGPRINTF("saved full screen: %d", is_full_screen); 00321 g_full_screen = is_full_screen; 00322 g_should_save = TRUE; 00323 } 00324 }
void meta_set_h_position | ( | gdouble | position | ) |
Definition at line 275 of file metadata.c.
References g_h_position, g_should_save, and LOGPRINTF.
Referenced by hadjustment_changed_cb().
00276 { 00277 LOGPRINTF("entry"); 00278 00279 if (position != g_h_position) 00280 { 00281 LOGPRINTF("saved h position: %f", position); 00282 g_h_position = position; 00283 g_should_save = TRUE; 00284 } 00285 }
void meta_set_v_position | ( | gdouble | position | ) |
Definition at line 288 of file metadata.c.
References g_should_save, g_v_position, and LOGPRINTF.
Referenced by vadjustment_changed_cb().
00289 { 00290 LOGPRINTF("entry"); 00291 00292 if (position != g_v_position) 00293 { 00294 LOGPRINTF("saved v position: %f", position); 00295 g_v_position = position; 00296 g_should_save = TRUE; 00297 } 00298 }
void meta_set_zoom_level | ( | gfloat | factor | ) |
Definition at line 301 of file metadata.c.
References g_should_save, g_zoom_level, and LOGPRINTF.
Referenced by view_set_zoom_level(), view_zoom_in(), and view_zoom_out().
00302 { 00303 LOGPRINTF("entry"); 00304 00305 if (factor != g_zoom_level) 00306 { 00307 LOGPRINTF("saved zoom: %f", factor); 00308 g_zoom_level = factor; 00309 g_should_save = TRUE; 00310 } 00311 }