void GnoteSyncClient::parse(const std::string & manifest_path) { // Set defaults before parsing m_last_sync_date = sharp::DateTime::now().add_days(-1); m_last_sync_rev = -1; m_file_revisions.clear(); m_deleted_notes.clear(); m_server_id = ""; if(!sharp::file_exists(manifest_path)) { m_last_sync_date = sharp::DateTime(); write(manifest_path); } sharp::XmlReader reader(manifest_path); while(reader.read()) { if(reader.get_node_type() == XML_READER_TYPE_ELEMENT) { if(reader.get_name() == "last-sync-date") { std::string value = reader.read_string(); try { m_last_sync_date = sharp::DateTime::from_iso8601(value); } catch(...) { /* TRANSLATORS: %s is file */ ERR_OUT(_("Unparsable last-sync-date element in %s"), manifest_path.c_str()); } } else if(reader.get_name() == "last-sync-rev") { std::string value = reader.read_string(); try { m_last_sync_rev = STRING_TO_INT(value); } catch(...) { /* TRANSLATORS: %s is file */ ERR_OUT(_("Unparsable last-sync-rev element in %s"), manifest_path.c_str()); } } else if(reader.get_name() == "server-id") { m_server_id = reader.read_string(); } else if(reader.get_name() == "note-revisions") { read_notes(reader, &GnoteSyncClient::read_updated_note_atts); } else if(reader.get_name() == "note-deletions") { read_notes(reader, &GnoteSyncClient::read_deleted_note_atts); } } } }
int main(int argc, char *argv[]){ char notes[] = { 0x55, 0x00, 0x00, 0x00}; int i; read_notes(notes); return 0; }
void gui_create_window(void) { GdkPixbuf *icon; contacts_filter_disabled = TRUE; all_pages_added = FALSE; fd_day_name = pango_font_description_from_string(config.day_name_font); fd_calendar = pango_font_description_from_string(config.calendar_font); fd_notes = pango_font_description_from_string(config.notes_font); main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); sprintf(tmpbuf, "OSMO - %s", _("a handy personal organizer")); gtk_window_set_title (GTK_WINDOW (main_window), tmpbuf); icon = gdk_pixbuf_new_from_inline(-1, osmo_icon, FALSE, NULL); gtk_window_set_icon (GTK_WINDOW(main_window), icon); g_object_unref(icon); gtk_window_move (GTK_WINDOW (main_window), config.window_x, config.window_y); if (calendar_only == FALSE) { gtk_window_set_default_size (GTK_WINDOW(main_window), config.window_size_x, config.window_size_y); } else { gtk_window_set_default_size (GTK_WINDOW(main_window), 500, -1); } gtk_window_set_resizable (GTK_WINDOW (main_window), TRUE); g_signal_connect (G_OBJECT (main_window), "delete_event", G_CALLBACK(gui_window_close_cb), NULL); g_signal_connect (G_OBJECT (main_window), "key_press_event", G_CALLBACK (key_press_cb), NULL); osmo_register_stock_icons(); osmo_tooltips = gtk_tooltips_new(); notebook = gtk_notebook_new(); GTK_WIDGET_UNSET_FLAGS(notebook, GTK_CAN_FOCUS); gtk_widget_show (notebook); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_RIGHT); gtk_container_add(GTK_CONTAINER(main_window), notebook); g_signal_connect(notebook, "switch-page", G_CALLBACK(notebook_sw_cb), NULL); if (calendar_only == FALSE) { read_notes (); } else { gtk_notebook_set_show_tabs (GTK_NOTEBOOK(notebook), FALSE); } gui_create_calendar(notebook); if (calendar_only == FALSE) { gui_create_tasks(notebook); gui_create_contacts(notebook); gui_create_options(notebook); gui_create_about(notebook); read_tasks_entries (); apply_date_colors(); read_contacts_entries (); set_export_active(); create_category_combobox (GTK_COMBO_BOX (cf_combobox), tasks_category_store, FALSE); gtk_combo_box_set_active (GTK_COMBO_BOX(cf_combobox), 0); contacts_filter_disabled = FALSE; number_of_tabs = NUMBER_OF_TABS; if(config.remember_latest_tab == TRUE) { current_tab = config.latest_tab; } else { current_tab = PAGE_CALENDAR; } } else { number_of_tabs = 1; current_tab = 0; } gui_url_initialize(); gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), current_tab); gtk_widget_show(main_window); all_pages_added = TRUE; set_today (TRUE); }